Skip to content
Myr

Created test case for using bytes and bytearray objects with files argument to Request.

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

authored by Rasmus Scholer (TimelineX) · committed by Rasmus Scholer (TimelineX) · parent 11b12c3 · Browse files · 1 file+13 added−0 removed
This commit

State

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

Diff stats

1 file+13 added−0 removed

  • other:+13 added−0 removed

1 file+13 added−0 removed

modified:test_requests.py+13 added
933 unmodified lines
934 p = r.prepare()935936 assert 'multipart/form-data' in p.headers['Content-Type']937938 def test_can_send_bytes_bytearray_objects_with_files(self):939 # Test bytes:940 data = {'a': 0.0}941 files = {'b': b'foo'}942 r = requests.Request('POST', httpbin('post'), data=data, files=files)943 p = r.prepare()944 assert 'multipart/form-data' in p.headers['Content-Type']945 # Test bytearrays:946 files = {'b': bytearray(b'foo')}947 r = requests.Request('POST', httpbin('post'), data=data, files=files)948 p = r.prepare()949 assert 'multipart/form-data' in p.headers['Content-Type']950951 def test_can_send_file_object_with_non_string_filename(self):952 f = io.BytesIO()953 f.name = 2954 r = requests.Request('POST', httpbin('post'), files={'f': f})
661 unmodified lines