flask icon indicating copy to clipboard operation
flask copied to clipboard

Header issue with many body request (put, post, etc)

Open alejandrofcarrera opened this issue 10 years ago • 0 comments

Hi everyone, i have been seeing this issue some days intermittently.

I have some methods with request.method = POST, but when i want to resend the same request to the same endpoint, there is an issue with the request.method and Flask throws Method not Allowed.

@app.route('/api/pause', methods=['POST']) json = {"signature":"1234", "value":"b"}

The first time was good and data was printed on console: print request.json

but the second time (i am doing the requests from Postman and this time i have changed value for a) i can see this on log:

{"signature":"1234","value":"b"}POST /api/pause HTTP/1.1" 405 -

the third time i can see this on log:

{"signature":"1234","value":"a"}POST /api/pause HTTP/1.1" 405 -

So, i do not know why Flask is inserting the previous POST values at the request.method and of course it throws Method Not Allowed, because pause method has not this allowed.

Note: I tried with or without threaded Flask option.

Do you know why i have this problem ? It is so important because i can not create a good API without POST or PUT as you would think.

alejandrofcarrera avatar Nov 25 '16 11:11 alejandrofcarrera