parameters: (self, body)
docstring: Prepare Content-Length header based on request method and body
docstring_summary: Prepare Content-Length header based on request method and body
docstring_tokens: Prepare Content - Length header based on request method and body
function: def prepare_content_length(self, body):
          """Prepare Content-Length header based on request method and body"""
          if body is not None:
              length = super_len(body)
              if length:
                  # If length exists, set it. Otherwise, we fallback
                  # to Transfer-Encoding: chunked.
                  self.headers['Content-Length'] = builtin_str(length)
          elif self.method not in ('GET', 'HEAD') and self.headers.get('Content-Length') is None:
              # Set Content-Length to 0 for methods that can have a body
              # but don't provide one. (i.e. not GET or HEAD)
              self.headers['Content-Length'] = '0'
function_tokens: def prepare_content_length ( self , body ) : if body is not None : length = super_len ( body ) if length : # If length exists, set it. Otherwise, we fallback # to Transfer-Encoding: chunked. self . headers [ 'Content-Length' ] = builtin_str ( length ) elif self . method not in ( 'GET' , 'HEAD' ) and self . headers . get ( 'Content-Length' ) is None : # Set Content-Length to 0 for methods that can have a body # but don't provide one. (i.e. not GET or HEAD) self . headers [ 'Content-Length' ] = '0'