[issue42417] Empty body {} in POST requests leads to 405 Method not allowed error

Christian Heimes report at bugs.python.org
Wed Nov 25 10:29:56 EST 2020


Christian Heimes <lists at cheimes.de> added the comment:

I also noticed that you are passing an explicit content length. {'Content-Length' : '0'} is wrong for a POST payload of "{}" with standard transfer encoding. It should be len("{}") == 2.

A zero content length only valid for chunked transfer encoding, which either requires header {"transfer-encoding": "chunked"} or encode_chunked=True.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42417>
_______________________________________


More information about the Python-bugs-list mailing list