Description
🐞 Describe the bug
I am used aiohttp as a client and a server to File Uploads,The server raised an error when I add headers in post request。
Could not find starting boundary b'--dd7db5e4c3bd4d5187bb978aef4d85b1'💡 To Reproduce
environment
python: 3.7.4
aiohttp: 3.7.4.post0
windows10
server
...
print("Enter form-data")
print("req header: ", request.headers)
data = await request.post()
file_data = data["file"]client
1、Not work
async with aiohttp.ClientSession() as session:
async with session.post(
url='http://{}:{}/mesh/recognize'.format(web_ip, web_port),
data=file_data,
headers={'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1'}
) as resp:console:
Enter form-data
req header: <CIMultiDictProxy('Host': '192.168.102.116:8000', 'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.7 aiohttp/3.7.4.post0', 'Content-Length': '364927')>
Could not find starting boundary b'--dd7db5e4c3bd4d5187bb978aef4d85b1'
---** predict is Failed **---
2、 work
async with aiohttp.ClientSession() as session:
async with session.post(
url='http://{}:{}/mesh/recognize'.format(web_ip, web_port),
data=file_data) as resp:console:
Enter form-data
req header: <CIMultiDictProxy('Host': '192.168.102.116:8000', 'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.7 aiohttp/3.7.4.post0', 'Content-Length': '364927', 'Content-Type': 'multipart/form-data; boundary=dd7db5e4c3bd4d5187bb978aef4d85b1')>
out: torch.float32
Predict result :tensor([[[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0000],
[5.0122, 4.7581, 4.8532, ..., 4.7490, 4.6256, 4.8851]]]),
run time is 3054.393768310547ms
---** predict is Successed! **---