Skip to content
Myr

Merge pull request #1181 from denis-ryzhkov/master

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

Fix of UnicodeDecodeError on unicode header name that can be converted to ascii.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 09a7251, 56f4b7c · Browse files · 3 files+5 added−0 removed
This commit

State

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

Diff stats

3 files+5 added−0 removed

  • other:+5 added−0 removed

3 files+5 added−0 removed

modified:requests/models.py+1 added
321 unmodified lines
322 def prepare_headers(self, headers):323 """Prepares the given HTTP headers."""324325 if headers:326 headers = dict((name.encode('ascii'), value) for name, value in headers.items())327 self.headers = CaseInsensitiveDict(headers)328 else:329 self.headers = CaseInsensitiveDict()330
337 unmodified lines
modified:AUTHORS.rst+1 added
118 unmodified lines
119- Jonatan Heyman120- David Bonner <dbonner@gmail.com> @rascalking121- Vinod Chandru122- Johnny Goodnow <j.goodnow29@gmail.com>123- Denis Ryzhkov <denisr@denisr.com>
modified:test_requests.py+3 added
249 unmodified lines
250 requests.get(url, params={'føø': 'føø'})251 requests.get(url, params={'foo': 'foo'})252 requests.get(httpbin('ø'), params={'foo': 'foo'})253254 def test_unicode_header_name(self):255 requests.put(httpbin('put'), headers={str('Content-Type'): 'application/octet-stream'}, data='\xff') # compat.str is unicode.256257 def test_urlencoded_get_query_multivalued_param(self):258259 r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))260 self.assertEqual(r.status_code, 200)
98 unmodified lines