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

Closed
lsdafjklsd opened this Issue Dec 22, 2012 · 5 comments

Projects

None yet

3 participants

@lsdafjklsd

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
Ember.js member

Is this for GET requests?

@wagenet
Ember.js member

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

@wagenet wagenet closed this Dec 22, 2012
@lsdafjklsd

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

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

@wagenet
Ember.js member

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

@lsdafjklsd

@wagenet That's it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment