Skip to content
Myr

Merge pull request #744 from tax/develop

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

Set content type before authentication

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 758cd24, 5e175ef · Browse files · 1 file+15 added−15 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+15 added−15 removed

  • other:+15 added−15 removed

1 file+15 added−15 removed

modified:requests/models.py+15 added-15 removed
484 unmodified lines
485 # Nottin' on you.486 body = None487 content_type = None488489 # Use .netrc auth if none was provided.490 if not self.auth and self.config.get('trust_env'):491 self.auth = get_netrc_auth(url)492493 if self.auth:494 if isinstance(self.auth, tuple) and len(self.auth) == 2:495 # special-case basic HTTP auth496 self.auth = HTTPBasicAuth(*self.auth)497498 # Allow auth to make its changes.499 r = self.auth(self)500501 # Update self to reflect the auth changes.502 self.__dict__.update(r.__dict__)503489 # Multi-part file uploads.490 if self.files:491 (body, content_type) = self._encode_files(self.files)492 else:
8 unmodified lines
501 # Add content-type if it wasn't explicitly provided.502 if (content_type) and (not 'content-type' in self.headers):503 self.headers['Content-Type'] = content_type504505 # Use .netrc auth if none was provided.506 if not self.auth and self.config.get('trust_env'):507 self.auth = get_netrc_auth(url)508509 if self.auth:510 if isinstance(self.auth, tuple) and len(self.auth) == 2:511 # special-case basic HTTP auth512 self.auth = HTTPBasicAuth(*self.auth)513514 # Allow auth to make its changes.515 r = self.auth(self)516517 # Update self to reflect the auth changes.518 self.__dict__.update(r.__dict__)519520 _p = urlparse(url)521 no_proxy = filter(lambda x:x.strip(), self.proxies.get('no', '').split(','))522 proxy = self.proxies.get(_p.scheme)523
320 unmodified lines