Force content-type for file uploads.
This commit is contained in:
parent
45c6619018
commit
e2c9cb7f8e
@ -1042,10 +1042,10 @@ class Client:
|
|||||||
try:
|
try:
|
||||||
# attempt to open the file and send the request
|
# attempt to open the file and send the request
|
||||||
with open(fp, 'rb') as f:
|
with open(fp, 'rb') as f:
|
||||||
files.add_field('file', f, filename=filename)
|
files.add_field('file', f, filename=filename, content_type='application/octet-stream')
|
||||||
response = yield from aiohttp.post(url, data=files, headers=headers, loop=self.loop)
|
response = yield from aiohttp.post(url, data=files, headers=headers, loop=self.loop)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
files.add_field('file', fp, filename=filename)
|
files.add_field('file', fp, filename=filename, content_type='application/octet-stream')
|
||||||
response = yield from aiohttp.post(url, data=files, headers=headers, loop=self.loop)
|
response = yield from aiohttp.post(url, data=files, headers=headers, loop=self.loop)
|
||||||
|
|
||||||
log.debug(request_logging_format.format(method='POST', response=response))
|
log.debug(request_logging_format.format(method='POST', response=response))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user