Skip to content

Commit

Permalink
Merge pull request psf#1117 from sigmavirus24/issue1106
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Reitz committed Jan 23, 2013
2 parents 472a5b4 + 27e814a commit 1a87f15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions requests/adapters.py
Expand Up @@ -13,7 +13,6 @@
from .models import Response
from .packages.urllib3.poolmanager import PoolManager, ProxyManager
from .packages.urllib3.response import HTTPResponse
from .hooks import dispatch_hook
from .compat import urlparse, basestring, urldefrag
from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
prepend_scheme_if_needed)
Expand Down Expand Up @@ -109,8 +108,6 @@ def build_response(self, req, resp):
response.request = req
response.connection = self

# Run the Response hook.
response = dispatch_hook('response', req.hooks, response)
return response

def get_connection(self, url, proxies=None):
Expand Down
6 changes: 5 additions & 1 deletion requests/sessions.py
Expand Up @@ -275,6 +275,10 @@ def request(self, method, url,
# Prepare the Request.
prep = req.prepare()

# If auth hooks are present, they aren't passed to `dispatch_hook`
# As such, we need to update the original hooks dictionary with them
hooks.update(prep.hooks)

# Send the request.
resp = self.send(prep, stream=stream, timeout=timeout, verify=verify, cert=cert, proxies=proxies)

Expand All @@ -295,7 +299,7 @@ def request(self, method, url,
resp.history = tuple(history)

# Response manipulation hook.
self.response = dispatch_hook('response', hooks, resp)
resp = dispatch_hook('response', hooks, resp)

return resp

Expand Down

0 comments on commit 1a87f15

Please sign in to comment.