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

Incorrect content-type sent with latest version of ember-data (3.9.0) #57

Open
KroneckerDeIta opened this issue Apr 10, 2019 · 0 comments

Comments

@KroneckerDeIta
Copy link

KroneckerDeIta commented Apr 10, 2019

ember-data-hal-9000 version: 0.3.3
ember-data version: 3.9.0

With ember-data version 3.8.0 the correct content-type is sent with a POST request, in particular application/hal+json, however, upgrading ember-data to 3.9.0 causes the content-type to be application/vnd.api+json.

We set the headers ourselves in the HalAdapter by doing

It looks like the ember-data guys have made a change so that the ajaxOptions method now sets the contentType to be application/vnd.api+json.

The workaround in my own code for this is to override ajaxOptions in each of my adapters to be:

/** * Overrides the AJAX options. */ ajaxOptions() { const hash = this._super(...arguments); hash.headers['content-type'] = "application/hal+json"; hash.headers['Accept'] = "application/hal+json"; return hash; },

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

1 participant