From: Ian Cordasco Date: Thu, 28 Mar 2013 12:33:34 +0000 (-0400) Subject: Fix the tests and unseparate comments from code X-Git-Tag: v1.2.0~2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cd23d8d6e9fee70e4cc51c37e0b6a111411f2c0;p=services%2Fpython-requests.git Fix the tests and unseparate comments from code See the comments on the previous few commits on GitHub. --- diff --git a/requests/models.py b/requests/models.py index 1451800..6ed2b59 100644 --- a/requests/models.py +++ b/requests/models.py @@ -394,7 +394,7 @@ class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): elif body is not None: l = super_len(body) if l: - self.headers['Content-Length'] = super_len(l) + self.headers['Content-Length'] = str(l) elif self.method not in ('GET', 'HEAD'): self.headers['Content-Length'] = '0' diff --git a/requests/sessions.py b/requests/sessions.py index 26131fc..961fc3b 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -429,12 +429,14 @@ class Session(SessionRedirectMixin): def send(self, request, **kwargs): """Send a given PreparedRequest.""" - # It's possible that users might accidentally send a Request object. - # Guard against that specific failure case. + # Set defaults that the hooks can utilize to ensure they always have + # the correct parameters to reproduce the previous request. kwargs.setdefault('stream', False) kwargs.setdefault('verify', True) kwargs.setdefault('proxies', {}) + # It's possible that users might accidentally send a Request object. + # Guard against that specific failure case. if getattr(request, 'prepare', None): raise ValueError('You can only send PreparedRequests.')