-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
{"data":null} throwing errors #4424
Comments
I have the same issue..
Looking into ember-data's |
@denisbetsi, @dmitrymatveev what is the http status code your server is returning in response to the |
I believe it was 200. I had to do a workaround and modify that behavior to stop this error from happening, should it be 404? |
Yes, Ember Data expects the server to return a 404 when there is no record for an id. |
@bmac
I got a working change that fixes it, will do a pull request when I get time to get back to it. I am just not sure how hacky is my solution. |
My understanding of the line:
Is it is talking about the response for fetching a related resource (For example: The section below http://jsonapi.org/format/#fetching-resources-responses-404 says:
Which I believe means when fetching a particular resource like |
It's either OR, so OR 200 Status with JSON body {"data":null} Either way, current code handles 404 status but not 200 + NULL response |
Just chiming in to confirm @bmac's understanding about the appropriateness of a 200 response with
If |
@dgeb, in my example there is a need to fetch a resource from a server which responds with P.S. As a side note... it seems that choosing to ignore parts of the core of the specification defeats the purpose of following specification entirely. |
200 responses with
I disagree with the statement that we ignore parts of the specification. I'd argue that we do follow the specification and our interpretation of it is correct, as confirmed by @dgeb. |
I'm going to close this issue. If you would like your adapter to reject a response of (Note: |
Looks like this issue was fixed already in
#3790
However it appears to be still happening.
Here's my setup
Here's the query:
this.store.findRecord('campaign',1);
Here's the response from server:
{"data":null}
Here's the error from ember:
Using
export default DS.JSONAPIAdapter.extend(DataAdapterMixin, ...
JSON API specs indicate "data": null to be a valid not found response.
The text was updated successfully, but these errors were encountered: