Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
The requirement of Content-Type : application/json only requests breaks flask-restless in IE9 and older.
While making post requests from theses older browsers, you have to use XDR instead of XMLHTTPRequests. This sucks for several reasons, but luckily jQuery and this plugin handle all that for you.
Unfortunately, the XDR spec doesn't allow for changing the Content-Type. It is permanently set to text/html. Check point number four on this post.
When I try and post to my server from IE9, flask-restless breaks at:
This is because there will never be a Content-Type in the headers when posting from old IE versions.
Have you found a way to use flask-restless on older versions of IE?
Hmm, that stinks. I prefer not to make the server more lenient about content types, since Flask-Restless will hopefully be able to serve up representations other than JSON in the future. Plus, this is really a client-side issue, not a server-side issue. On the other hand, I don't like to exclude people from being able to use this software :) It seems we are at an impasse.
Is there any other way to distinguish an HTTP request that comes from Internet Explorer as opposed to a request that comes from another client (for example, using the tools provided by Flask)?
Please examine and test pull request #276. If this fixes the problem for you, I'll merge it in.
Essentially, it checks if the user agent string indicates that the request comes from a Microsoft Internet Explorer 8 or 9 browser, and relaxes the content type requirement if that is the case.