Browse Source

Failing on empty body is intended for non-GET requests

See corresponding test cases for details and reasoning
pull/1939/head
Timo Puschkasch 9 years ago committed by GitHub
parent
commit
ba9ea2863c
  1. 9
      flask/wrappers.py

9
flask/wrappers.py

@ -151,12 +151,11 @@ class Request(RequestBase):
try:
data = _get_data(self, cache)
if not data and not force:
if self.method == 'GET' and not data and not force:
# Some clients will send a MIME-type of "application/json"
# with an empty message body by default, even on empty
# get requests. This behaviour can cause loading to fail
# with a ValueError although RFC2616 does not explicitly
# forbid such requests.
# with an empty message body on empty get requests.
# This can cause loading to fail with a ValueError
# although RFC2616 does not explicitly forbid such requests.
rv = None
elif request_charset is not None:
rv = json.loads(data, encoding=request_charset)

Loading…
Cancel
Save