diff --git a/AUTHORS.rst b/AUTHORS.rst index 1d66c4bf..9a7f25d5 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -114,3 +114,4 @@ Patches and Suggestions - Ian Cordasco @sigmavirus24 - Rhys Elsmore - André Graf (dergraf) +- Stephen Zhuang (everbird) diff --git a/requests/models.py b/requests/models.py index f02cec33..c19d3cca 100644 --- a/requests/models.py +++ b/requests/models.py @@ -360,9 +360,9 @@ class Request(object): for field, val in fields: if isinstance(val, list): for v in val: - new_fields.append((field, str(v))) + new_fields.append((field, builtin_str(v))) else: - new_fields.append((field, str(val))) + new_fields.append((field, builtin_str(val))) for (k, v) in files: # support for explicit filename diff --git a/tests/test_requests.py b/tests/test_requests.py index 9ed4ad03..27da6b92 100755 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -338,12 +338,23 @@ class RequestsTestSuite(TestSetup, TestBaseMixin, unittest.TestCase): with open(__file__) as f: url = service('post') - post1 = post(url, - files={'some': f}, - data={'some': 'data'}) + post1 = post(url, data={'some': 'data'}, files={'some': f}) post2 = post(url, data={'some': 'data'}, files=[('some', f)]) - post3 = post(url, data=[('some', 'data')], - files=[('some', f)]) + post3 = post(url, data=[('some', 'data')], files=[('some', f)]) + + self.assertEqual(post1.status_code, 200) + self.assertEqual(post2.status_code, 200) + self.assertEqual(post3.status_code, 200) + + def test_POSTBIN_GET_POST_FILES_WITH_CJK_PARAMS(self): + + for service in SERVICES: + + with open(__file__) as f: + url = service('post') + post1 = post(url, data={'some': '中文'}, files={'some': f}) + post2 = post(url, data={'some': '日本語'}, files=[('some', f)]) + post3 = post(url, data=[('some', '한국의')], files=[('some', f)]) self.assertEqual(post1.status_code, 200) self.assertEqual(post2.status_code, 200)