In case you are wondering the form post data is not being processed by server side in Flask framework, then you are definitely in the right place. Sadly, its very subtle in the flask documentation and I wasted considerable amount of time for such a trivial issue. Server side Flask Code is : Simple form submission was giving me 400 Bad request and much to my chagrin, I see a simple curl call giving me the desired result .. . . So what went wrong ? apparently I had forgotten to set input name for my form elements and Flask uses input name instead of id which I feel is kinda weird.. anyways.. that solved the problem for me. Hope fully no more surprises in flask.
2 Comments
Steve
6/2/2015 09:15:28 pm
It's not that Flask uses the input name - that's just how forms work. The id has nothing to do with the submitted data. No web frameworks can use the id attribute instead of name because that's not how html forms work...
Reply
I had this problem as well using polymer. I was using the iron-ajax component to do a GET to flask. I accidentally left in the 'content-type="application/json" attribute and this caused flask to return a 400. I think because it was assuming that since the content type was declared json that the request should have a body and I did not send one.
Reply
Leave a Reply. |
Author
Finally awakened from my comatose. When inspiration gives some insight, I write! . Victim of the Next Big Thing Syndrome & Pre-Optimization. Categories
All
Archives
April 2014
|