POSTing to a flask app
Hi, I have a very simple flask app:
When I try to POST to my endpoint in postman I get this in my log:
It is a GET request?
This I think has been my problem when I try to run
request.get_json()
as there is nothing in the body as it is a GET?
My question is, how can I fix this to send/receive POST requests properly (it works locally).
Thanks :)8 Replies
Project ID:
N/A
do you have a procfile?
No
okay i see you are using waitress, no need for gunicorn
Solution
your problem is that you arent requesting over https
Wow, thank you that has solved it
Also, if you are doing GET and POST on the same endpoint, you should probably use a conditional on the request to see if it’s a post, then do your logic inside the conditional, and then provide your get logic outside of the conditional.
Just sayin
nerd