@ Override protected Buffer buffer ( final boolean fullRequest ) { // INITIALIZATION // host port if ( header ( HEADER_HOST ) == null ) { setHostHeader ( ) ; } // form Buffer formBuffer = formBuffer ( ) ; // query string String queryString = queryString ( ) ; // user-agent if ( header ( "User-Agent" ) == null ) { header ( "User-Agent" , Defaults . userAgent ) ; } // POST method requires Content-Type to be set if ( method . equals ( "POST" ) && ( contentLength ( ) == null ) ) { contentLength ( 0 ) ; } // BUILD OUT Buffer request = new Buffer ( ) ; request . append ( method ) . append ( SPACE ) . append ( path ) ; if ( query != null && ! query . isEmpty ( ) ) { request . append ( ' ' ) ; request . append ( queryString ) ; } request . append ( SPACE ) . append ( httpVersion ) . append ( CRLF ) ; populateHeaderAndBody ( request , formBuffer , fullRequest ) ; return request ; }
Prepares the request buffer .