Skip to content
Myr

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

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

authored by Denis Ryzhkov · committed by Denis Ryzhkov · parent 5d9fcc7 · Browse files · 3 files+8 added−1 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+8 added−1 removed

  • other:+8 added−1 removed

3 files+8 added−1 removed

modified:requests/models.py+2 added
323 unmodified lines
324 def prepare_headers(self, headers):325 """Prepares the given HTTP headers."""326327 if headers:328 if is_py2:329 headers = dict((builtin_str(name), value) for name, value in headers.items())330 self.headers = CaseInsensitiveDict(headers)331 else:332 self.headers = CaseInsensitiveDict()333
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+5 added-1 removed
8 unmodified lines
9import unittest1011import requests12from requests.auth import HTTPDigestAuth13from requests.compat import str13from requests.compat import is_py2, str1415try:16 import StringIO17except ImportError:
232 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 if is_py2:256 requests.put(httpbin('put'), headers={unicode('Content-Type'): 'application/octet-stream'}, data='\xff')257258 def test_urlencoded_get_query_multivalued_param(self):259260 r = requests.get(httpbin('get'), params=dict(test=['foo', 'baz']))261 self.assertEqual(r.status_code, 200)
98 unmodified lines