Skip to content
Myr

All tests pass, time for a PR.

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

authored by Ian Cordasco · committed by Ian Cordasco · parent e02da89 · Browse files · 2 files+2 added−4 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+2 added−4 removed

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

2 files+2 added−4 removed

modified:requests/models.py+2 added-2 removed
346 unmodified lines
347 """348 if (not files) or isinstance(self.data, str):349 return None350351 new_fields = []352 fields = to_key_val_list(self.data)353 files = to_key_val_list(files)354355 for (k, v) in files:
6 unmodified lines
362 if isinstance(fp, str):363 fp = StringIO(fp)364 if isinstance(fp, bytes):365 fp = BytesIO(fp)365 fields.append((k, (fn, fp.read())))366 new_fields.append((k, (fn, fp.read())))367367 new_fields = []368 for field, val in fields:369 if isinstance(val, list):370 for v in val:371 new_fields.append((k, str(v)))
494 unmodified lines
modified:tests/test_requests.py-2 removed
1036 unmodified lines
1037 t = json.loads(r.text)1038 self.assertEqual(t.get('form'), {'field': ['a', 'b']})1039 self.assertEqual(t.get('files'), files)1040 r = post(httpbin('post'), data=data, files=files.items())1041 t = r.json1042 self.assertEqual(t.get('form'), {'field': 'a, b'})1041 self.assertEqual(t.get('files'), files)10421043 def test_str_data_content_type(self):1044 data = 'test string data'
81 unmodified lines