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

When using the RESTAdapter with Express.js, server returning 400 error "invalid json" #1615

Closed
haywoood opened this issue Dec 22, 2012 · 5 comments

Comments

@haywoood
Copy link

I'm not sure if this problem is on Express's end or here, but for some reason the default hash.contentType = 'application/json; charset=utf-8'; under the RESTAdapters ajax function causes express to return the 400 error Error: invalid json.

Modifying the default content type to
hash.contentType = 'application/x-www-form-urlencoded; charset=utf-8';
fixes the issue.

@trek
Copy link
Member

trek commented Dec 22, 2012

Is this for GET requests?

@wagenet
Copy link
Member

wagenet commented Dec 22, 2012

This should be filed on https://github.com/emberjs/data/issues.

@wagenet wagenet closed this as completed Dec 22, 2012
@haywoood
Copy link
Author

@trek Yea, was getting it on App.User.find().

Also, I totally meant to to submit this to the ember-data project.

@wagenet
Copy link
Member

wagenet commented Dec 22, 2012

I'm pretty sure it's this issue: emberjs/data#402

@haywoood
Copy link
Author

@wagenet That's it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants