Detect Content Type of file uploaded in multipart/form-data request

Closes #271 #285 #398

This adds filename-based detection. It's still not possible to specify the
content type manually, though.
This commit is contained in:
Jakub Roztocil committed 2016-02-28 15:49:01 +08:00
1 parent 59e22b16b8
commit 56f498c153
4 files changed
+12 -3

No files matched your search

+2
View File
@@ -23,6 +23,7 @@ class TestMultipartFormDataFileUpload:
' filename="%s"' % os.path.basename(FILE_PATH) in r
assert FILE_CONTENT in r
assert '"foo": "bar"' in r
assert 'Content-Type: text/plain' in r
def test_upload_multiple_fields_with_the_same_name(self, httpbin):
r = http('--form', '--verbose', 'POST', httpbin.url + '/post',
@@ -34,6 +35,7 @@ class TestMultipartFormDataFileUpload:
# Should be 4, but is 3 because httpbin
# doesn't seem to support filed field lists
assert r.count(FILE_CONTENT) in [3, 4]
assert r.count('Content-Type: text/plain') == 2
class TestRequestBodyFromFilePath: