1 year ago

#363435

test-img

tscherg

Flask app request body added to http method on GET calls (only every other request)

When GETting a resource in a Flask app from Postman for Windows Version 9.15.10, the request body seems to mess up the parsing of the HTTP request. There are two slightly different behaviours depending on the request body being one line or more lines. There seems to be a strange interference with HTTP0.9 (maybe related to https://bugs.python.org/issue28548)

  1. request body with one line: every other request has messed up parsing. The used request body is {"some":"data"} logs:
Request 1:
[01/Apr/2022 11:54:08] "GET /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/1.1" 200 -

Request 2:
[01/Apr/2022 11:54:42] "{"some":"data"}GET /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/1.1" 405 -

Request 3:
[01/Apr/2022 11:56:08] "GET /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/1.1" 200 -

Request 4:
[01/Apr/2022 11:56:42] "{"some":"data"}GET /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/1.1" 405 -

...etc

2 . request body with more than one line: every request has messed up parsing. The used request body is {"some":"data"} again, but with newlines (beautified json). logs:

Every Request - actually 3 logs:
[01/Apr/2022 11:57:22] "GET /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/1.1" 200 -
[01/Apr/2022 11:57:22] code 400, message Bad request syntax ('{')
[01/Apr/2022 11:57:22] "None /resource/598feed4-1d23-4818-8a5a-a30daddeb23b/subresource HTTP/0.9" HTTPStatus.BAD_REQUEST -

Thank you so much for any help!

python

flask

werkzeug

http-0.9

0 Answers

Your Answer

Accepted video resources