Skip to content
Myr

Support CJK parameters when post files

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

authored by Stephen Zhuang · committed by Stephen Zhuang · parent 0c02544 · Browse files · 2 files+19 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

2 files+19 added−2 removed

  • tests:+17 added−0 removed
  • other:+2 added−2 removed

2 files+19 added−2 removed

modified:requests/models.py+2 added-2 removed
358 unmodified lines
359360 for field, val in fields:361 if isinstance(val, list):362 for v in val:363 new_fields.append((field, str(v)))363 new_fields.append((field, builtin_str(v)))364 else:365 new_fields.append((field, str(val)))365 new_fields.append((field, builtin_str(val)))366367 for (k, v) in files:368 # support for explicit filename369 if isinstance(v, (tuple, list)):
523 unmodified lines
modified:tests/test_requests.py+17 added
345 unmodified lines
346 self.assertEqual(post1.status_code, 200)347 self.assertEqual(post2.status_code, 200)348 self.assertEqual(post3.status_code, 200)349350 def test_POSTBIN_GET_POST_FILES_WITH_CJK_PARAMS(self):351352 for service in SERVICES:353354 with open(__file__) as f:355 url = service('post')356 post1 = post(url,357 files={'some': f},358 data={'some': '中文'})359 post2 = post(url, data={'some': '日本語'}, files=[('some', f)])360 post3 = post(url, data=[('some', '한국의')],361 files=[('some', f)])362363 self.assertEqual(post1.status_code, 200)364 self.assertEqual(post2.status_code, 200)365 self.assertEqual(post3.status_code, 200)366367 def test_POSTBIN_GET_POST_FILES_WITH_HEADERS(self):368369 for service in SERVICES:370
830 unmodified lines