Don't skip afterFetch in cases where there's no response body. - #35
Merged
Conversation
zpencerq
force-pushed
the
keep_afterfetch
branch
from
October 22, 2019 21:18
16fe751 to
8a31bcc
Compare
For some reason, the prior method of constructing a Response was having a status code of 200.
zpencerq
force-pushed
the
keep_afterfetch
branch
from
October 23, 2019 16:55
8a31bcc to
cb8a0af
Compare
github-actions Bot
pushed a commit
that referenced
this pull request
Jul 27, 2026
## [0.11.0](v0.10.25...v0.11.0) (2026-07-27) ### Features * add support for constructor assignment for collections ([#109](#109)) ([36a223a](36a223a)) * middleware.afterFilters can now set a newResponse to use (permit retry or re-rerouting request) ([#100](#100)) ([5970ad9](5970ad9)) * singular Resource Handling (read/write operations) ([#98](#98)) ([0f0ec91](0f0ec91)) ### Bug Fixes * declare type definitions on EventBus ([#75](#75)) ([7074b1d](7074b1d)), closes [#54](#54) * don't skip afterFetch in cases where there's no response body. ([#35](#35)) ([db52073](db52073)) * encode query parameters regardless of the browser ([#104](#104)) ([e964909](e964909)) * remove all marked-for-destruction relations, not every other one ([#137](#137)) ([f3dcbe6](f3dcbe6)), closes [#63](#63) * self referential relationships will not longer silently fail ([dd2247e](dd2247e)), closes [#110](#110) * validation error when relationship has nested records ([#101](#101)) ([abf6b5d](abf6b5d))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original error was that the
afterFetchmiddleware functions weren't being called because of various short-circuiting logic withinRequest#_handleResponse.Behavior changes
DELETEand getting a200response, it will now try to parse that body. Prior to this change-set, it would skip.200should be returned if there is only top-level meta data in the response. Presumably, thatmetawould be useful to be able to access.dataandmetabeingundefinedrather than justdata(aside from a JSON parse error).metabeing defined is valid.afterFetchcalls happen withjson=nullin the case of a204 No Content.Questions:
The spec for deleting resources does not specify if a response body MUST be returned. However, you could interpret that "a deletion request has been accepted for processing ... and no content is returned" requires that a
204be returned by the server. Should we remove the ability for non-204responses to be empty?The default
jsonbody ofnullwas chosen instead of an empty object because it's representing the absence of a body; I figured just{}would be confusing (but I also don't like giving people NPE). Do you think we should introduce someNull Objectdefault that'll explain where it came from (empty body) on field access?