Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't post from IE 8 or IE 9 #267

Closed
ondrae opened this issue Dec 27, 2013 · 3 comments
Labels
bug

Comments

@ondrae
Copy link

@ondrae ondrae commented Dec 27, 2013

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:

if not content_type.startswith('application/json'):
AttributeError: 'NoneType' object has no attribute 'startswith'

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?

@jfinkels

This comment has been minimized.

Copy link
Owner

@jfinkels jfinkels commented Jan 11, 2014

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)?

@jfinkels

This comment has been minimized.

Copy link
Owner

@jfinkels jfinkels commented Jan 14, 2014

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.

@jfinkels

This comment has been minimized.

Copy link
Owner

@jfinkels jfinkels commented Mar 12, 2014

Since there was no response, I'm just going to include this. If it doesn't work, let me know.

@jfinkels jfinkels closed this Mar 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.