Skip to content
Myr

Merge pull request #1097 from matthewlmcclure/issues/1096

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Resolves the parts of #1096 in requests proper.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents cd0cbad, 628e393 · Browse files · 1 file+13 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+13 added−7 removed

  • other:+13 added−7 removed

1 file+13 added−7 removed

modified:requests/models.py+13 added-7 removed
373 unmodified lines
374 content_type = None375 else:376 content_type = 'application/x-www-form-urlencoded'377378 self.headers['Content-Length'] = '0'379 if hasattr(body, 'seek') and hasattr(body, 'tell'):380 body.seek(0, 2)381 self.headers['Content-Length'] = str(body.tell())382 body.seek(0, 0)383 elif body is not None:384 self.headers['Content-Length'] = str(len(body))378 self.prepare_content_length(body)379380 # Add content-type if it wasn't explicitly provided.381 if (content_type) and (not 'content-type' in self.headers):382 self.headers['Content-Type'] = content_type383384 self.body = body385386 def prepare_content_length(self, body):387 self.headers['Content-Length'] = '0'388 if hasattr(body, 'seek') and hasattr(body, 'tell'):389 body.seek(0, 2)390 self.headers['Content-Length'] = str(body.tell())391 body.seek(0, 0)392 elif body is not None:393 self.headers['Content-Length'] = str(len(body))394395 def prepare_auth(self, auth):396 """Prepares the given HTTP auth data."""397 if auth:398 if isinstance(auth, tuple) and len(auth) == 2:
5 unmodified lines
404405 # Update self to reflect the auth changes.406 self.__dict__.update(r.__dict__)407408 # Recompute Content-Length409 self.prepare_content_length(self.body)410411 def prepare_cookies(self, cookies):412 """Prepares the given HTTP cookie data."""413414 if isinstance(cookies, cookielib.CookieJar):
233 unmodified lines