mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
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:
1 parent
59e22b16b8
commit
56f498c153
4 files changed
+12
-3
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user