Skip to content
Myr

Call auth callable before encoding body data

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

authored by Idan Gazit · committed by Donald Stufft · parent 0aedef0 · Browse files · 1 file+15 added−16 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−16 removed

  • other:+15 added−16 removed

1 file+15 added−16 removed

modified:requests/models.py+15 added-16 removed
480 unmodified lines
481 # Nottin' on you.482 body = None483 content_type = None484485 # Multi-part file uploads.486 if self.files:487 (body, content_type) = self._enc_files488 else:489 if self.data:490491 body = self._enc_data492 if isinstance(self.data, str):493 content_type = None494 else:495 content_type = 'application/x-www-form-urlencoded'496497 # Add content-type if it wasn't explicitly provided.498 if (content_type) and (not 'content-type' in self.headers):499 self.headers['Content-Type'] = content_type500485 # Use .netrc auth if none was provided.486 if not self.auth and self.config.get('trust_env'):487 self.auth = get_netrc_auth(url)488
7 unmodified lines
496497 # Update self to reflect the auth changes.498 self.__dict__.update(r.__dict__)499500 # Multi-part file uploads.501 if self.files:502 (body, content_type) = self._enc_files503 else:504 if self.data:505 body_params, body = self._encode_params(self.data)506 if isinstance(body_params, list) and isinstance(body, str):507 content_type = 'application/x-www-form-urlencoded'508 else:509 content_type = None510511 # Add content-type if it wasn't explicitly provided.512 if (content_type) and (not 'content-type' in self.headers):513 self.headers['Content-Type'] = content_type514515 _p = urlparse(url)516 proxy = self.proxies.get(_p.scheme)517518 if proxy:
333 unmodified lines