Skip to content
Myr

Merge pull request #758 from volker48/develop

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

Develop

authored by Kenneth Reitz · committed by Kenneth Reitz · parents b5ca4b4, f60579d · Browse files · 3 files+11 added−2 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+11 added−2 removed

  • tests:+7 added−0 removed
  • other:+4 added−2 removed

3 files+11 added−2 removed

modified:requests/compat.py+2 added
89 unmodified lines
90 from Cookie import Morsel91 from StringIO import StringIO92 from .packages import chardet9394 builtin_str = str95 bytes = str96 str = unicode97 basestring = basestring98
6 unmodified lines
105 from http.cookies import Morsel106 from io import StringIO107 from .packages import chardet2 as chardet108109 builtin_str = str110 str = str111 bytes = bytes112 basestring = (str,bytes)113
modified:requests/models.py+2 added-2 removed
30 unmodified lines
31 stream_decode_response_unicode, get_netrc_auth, get_environ_proxies,32 DEFAULT_CA_BUNDLE_PATH)33from .compat import (34 cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,35 StringIO, is_py2, chardet, json)35 StringIO, is_py2, chardet, json, builtin_str)3637REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)38CONTENT_CHUNK_SIZE = 10 * 102439
452 unmodified lines
492 else:493 if self.data:494495 body = self._encode_params(self.data)496 if isinstance(self.data, str) or hasattr(self.data, 'read'):496 if isinstance(self.data, str) or isinstance(self.data, builtin_str) or hasattr(self.data, 'read'):497 content_type = None498 else:499 content_type = 'application/x-www-form-urlencoded'500
343 unmodified lines
modified:tests/test_requests.py+7 added
971 unmodified lines
972 t = json.loads(r.text)973 self.assertEqual(t.get('form'), {'field': 'a, b'})974 self.assertEqual(t.get('files'), files)975976 def test_str_data_content_type(self):977 data = 'test string data'978 r = post(httpbin('post'), data=data)979 t = json.loads(r.text)980 self.assertEqual(t.get('headers').get('Content-Type'), '')981982983if __name__ == '__main__':984 unittest.main()