parameters: (self, request)
return_statement: return status_line.encode('utf-8') + body
docstring: Convert an HttpRequest object into a string.
  
      Args:
        request: HttpRequest, the request to serialize.
  
      Returns:
        The request as a string in application/http format.
docstring_summary: Convert an HttpRequest object into a string.
docstring_tokens: Convert an HttpRequest object into a string .
function: def _serialize_request(self, request):
      """Convert an HttpRequest object into a string.
  
      Args:
        request: HttpRequest, the request to serialize.
  
      Returns:
        The request as a string in application/http format.
      """
      # Construct status line
      parsed = urlparse.urlparse(request.uri)
      request_line = urlparse.urlunparse(
          (None, None, parsed.path, parsed.params, parsed.query, None)
          )
      status_line = request.method + ' ' + request_line + ' HTTP/1.1\n'
      major, minor = request.headers.get('content-type', 'application/json').split('/')
      msg = MIMENonMultipart(major, minor)
      headers = request.headers.copy()
  
      if request.http is not None and hasattr(request.http.request,
          'credentials'):
        request.http.request.credentials.apply(headers)
  
      # MIMENonMultipart adds its own Content-Type header.
      if 'content-type' in headers:
        del headers['content-type']
  
      for key, value in headers.iteritems():
        msg[key] = value
      msg['Host'] = parsed.netloc
      msg.set_unixfrom(None)
  
      if request.body is not None:
        msg.set_payload(request.body)
        msg['content-length'] = str(len(request.body))
  
      # Serialize the mime message.
      fp = StringIO.StringIO()
      # maxheaderlen=0 means don't line wrap headers.
      g = Generator(fp, maxheaderlen=0)
      g.flatten(msg, unixfrom=False)
      body = fp.getvalue()
  
      # Strip off the \n\n that the MIME lib tacks onto the end of the payload.
      if request.body is None:
        body = body[:-2]
  
      return status_line.encode('utf-8') + body
function_tokens: def _serialize_request ( self , request ) : # Construct status line parsed = urlparse . urlparse ( request . uri ) request_line = urlparse . urlunparse ( ( None , None , parsed . path , parsed . params , parsed . query , None ) ) status_line = request . method + ' ' + request_line + ' HTTP/1.1\n' major , minor = request . headers . get ( 'content-type' , 'application/json' ) . split ( '/' ) msg = MIMENonMultipart ( major , minor ) headers = request . headers . copy ( ) if request . http is not None and hasattr ( request . http . request , 'credentials' ) : request . http . request . credentials . apply ( headers ) # MIMENonMultipart adds its own Content-Type header. if 'content-type' in headers : del headers [ 'content-type' ] for key , value in headers . iteritems ( ) : msg [ key ] = value msg [ 'Host' ] = parsed . netloc msg . set_unixfrom ( None ) if request . body is not None : msg . set_payload ( request . body ) msg [ 'content-length' ] = str ( len ( request . body ) ) # Serialize the mime message. fp = StringIO . StringIO ( ) # maxheaderlen=0 means don't line wrap headers. g = Generator ( fp , maxheaderlen = 0 ) g . flatten ( msg , unixfrom = False ) body = fp . getvalue ( ) # Strip off the \n\n that the MIME lib tacks onto the end of the payload. if request . body is None : body = body [ : - 2 ] return status_line . encode ( 'utf-8' ) + body