yohanboniface / falcon-multipart

[Experimental] Parse multipart/form-data in falcon
MIT License
58 stars 11 forks source link

ValueError: Invalid boundary in multipart form: b'' #8

Closed yohanboniface closed 7 years ago

yohanboniface commented 7 years ago
[2017-05-11 15:27:24 +0200] [30466] [ERROR] Error handling request /search/csv
Traceback (most recent call last):
  File "/srv/addok/venv/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 135, in handle
    self.handle_request(listener, req, client, addr)
  File "/srv/addok/venv/lib/python3.4/site-packages/gunicorn/workers/sync.py", line 176, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/srv/addok/venv/lib/python3.4/site-packages/falcon/api.py", line 180, in __call__
    process_request(req, resp)
  File "/srv/addok/venv/lib/python3.4/site-packages/falcon_multipart/middleware.py", line 20, in process_request
    form = self.parse(stream=req.stream, environ=req.env)
  File "/srv/addok/venv/lib/python3.4/site-packages/falcon_multipart/middleware.py", line 10, in parse
    return self.parser(fp=stream, environ=environ)
  File "/usr/lib/python3.4/cgi.py", line 559, in __init__
    self.read_multi(environ, keep_blank_values, strict_parsing)
  File "/usr/lib/python3.4/cgi.py", line 681, in read_multi
    raise ValueError('Invalid boundary in multipart form: %r' % (ib,))
ValueError: Invalid boundary in multipart form: b''
alexalv commented 5 years ago

Encountered the same error, the problem in my case was in Content-Type header which I was setting explicitly on the client side. Related StackOverflow question tldr: Do not set Content-Type header on the client side.