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

JSONAPI adapter content-type is being blanked over by application/vnd.api+json on POST #6167

Closed
Benjy1979 opened this issue Jun 18, 2019 · 8 comments
Labels
🏷️ bug This PR primarily fixes a reported issue

Comments

@Benjy1979
Copy link
Contributor

Benjy1979 commented Jun 18, 2019

Reproduction

Please provide one of the following:

  • a PR linking to this issue with a failing test showing the issue
    A what?
  • a Twiddle with a simplified reproduction and instructions for how to
    observe the unexpected result.
    Not familiar with it. It doesn't let me add an adapter and does not have the right version in the dropdown.
  • a github repository with a simplified reproduction and instructions for how to observe the unexpected result
    Here is a repository

Check POST in the model adapters of CreateRecord call.

Description

See this for description

Versions

Run the following command and paste the output below: npm ls ember-source && npm ls ember-cli && npm ls ember-data.

[email protected] C:\inetpub\wwwroot\ember-roomviewer-bighomeshop
`-- [email protected]

[email protected] C:\inetpub\wwwroot\ember-roomviewer-bighomeshop
`-- [email protected]

[email protected] C:\inetpub\wwwroot\ember-roomviewer-bighomeshop
`-- [email protected]

P.S. If any of the packages show more than one installed version, that may be the root cause of the issue!


Thanks again!

The ember-data Team <3

@Benjy1979
Copy link
Contributor Author

Benjy1979 commented Jun 18, 2019

I've put a project showing simple program to reproduce the issue:
Here is a repository

The application route has CreateRecord in it. It will use the plan adapter (as proven by the alert("Called this"); appearing in the application route).

It makes this request in chrome. I can see the x-access-token there look, but the content-type is not set.

Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Origin: http://localhost:4200
Referer: http://localhost:4200/
User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Mobile Safari/537.36
x-access-token: TOKENHERE
X-Requested-With: XMLHttpRequest

@runspired
Copy link
Contributor

@Benjy1979 if you properly case to Content-Type is it set?

@Benjy1979
Copy link
Contributor Author

No it stays the same

@runspired
Copy link
Contributor

I think this will resolve it: #6169

@Benjy1979
Copy link
Contributor Author

Benjy1979 commented Jun 18, 2019

How do I get hold of the changes, I'm not too familiar with what I can do with that link. 1 of the tests are failing.

I normally just use ember-cli-update

@runspired
Copy link
Contributor

@snewcomer was this fixed by #6341 ?

@snewcomer
Copy link
Contributor

Yes it was! At least for the fetch case - https://github.com/emberjs/data/pull/6341/files#diff-ad84fbc878beedc97078e5053b8e41d7R1102

For ajax, it is relying on contentType and shouldn't be blanking over it anymore!

@Benjy1979
Copy link
Contributor Author

Benjy1979 commented Feb 24, 2020

Ah yes it is working now, my extended adapter for a particular model is reading the header callback and the request has the specified one in the request. Thrilled, and thanks very much.

@runspired runspired added 🏷️ bug This PR primarily fixes a reported issue and removed Bug labels Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bug This PR primarily fixes a reported issue
Projects
None yet
Development

No branches or pull requests

3 participants