-
-
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
Allow 'false' payload to get normalized #4132
Conversation
Yeah looks like the interop may not be the best place to test this. I'll dig a bit more later. |
The code / objective overall looks good to me, and at a glance seems backwards compatible. Ping me tomorrow and I can help you find a better file / way to test. |
43fbe97
to
b79fe62
Compare
@bmac thanks for the ping, looks like it still fails though |
var ApplicationSerializer = DS.JSONSerializer.extend({ | ||
normalizeQueryResponse() { | ||
callCount++; | ||
return this._super(...arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the error is because the JSONSerializer
doesn't know how to normalize a response of false. Changing this line to return { data: [] };
should fix the test.
b79fe62
to
8a83426
Compare
😱 tests are green! Thank for the pointers @bmac! I'll have to figure out why I can't get things installed on my machine. Initially I thought your suggestion meant that JSONSerializer should know how to handle a |
So I took a look and I have a question about your initial statement @meirish:
I am interested in why you want to hit the normalization even though the response is not a success. I think overwriting That being said, I think the change proposed in this PR is 👍. It would be even ok to remove the check as a whole, since this should be a serializer concern. But this might be a breaking change, so that's not an option for now. @meirish can you update the if statement and also check for |
Or we could use |
Looks like this pr has gone stale. I'm going to close it but feel free to reopen the pr if you get a chance to address @pangratz's comments. |
I'm coding against an API that returns
true
for successful update andfalse
for an unsuccessful one, both with a status code of 200.When I was attempting to customize what happened in the uncessful path, I found that my normalization code wasn't being run at all. I tracked it down to this
_commit
method in system/store.js file.false
is a valid JSON response, so I've updated the guard to usetypeof adapterPayload !== 'undefined'
.I'm not sure the test I wrote is in the correct place or if it will even work (the directions on the homepage didn't work for me for running the tests), any pointers / comments about that would be appreciated.
Thanks!