-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX fetch] Don't set json:api content-type for DELETE requests
- Loading branch information
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
f26d07b
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.
@dcyriller @runspired This change actually seems to break what it seemed to attempt to fix.
Needed to override ajaxOptions in my adapter to get deletes working again:
Either it should go back to the way it was or, 'DELETE' needs to be added to the array like in my code sample.
f26d07b
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.
@victornamuso why would your delete requests expect this header?
f26d07b
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.
That said it does seem that jsonapi wants us to set this header regardless: https://jsonapi.org/format/#crud-deleting
f26d07b
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.
@runspired Not sure. Trying to dig around our api to see why it's throwing an error if the contentType isn't set.
f26d07b
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.
The spec is about the response (EDIT: this is wrongAccept
) not the request (Content-Type
) for DELETEs @runspired ;)I've opened a PR to revert this change, it was breaking: #5999
Sorry about that @victornamuso
f26d07b
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.
@victornamuso to answer your question why the header is needed, I have a router in a content-negotiating backend that routes all JSONAPI related requests to a CRUD layer, then some other application/json related requests go to some other CRUD layer that happens to not support deletes, then all other requests to a static web serving layer associated with a webroot directory on the filesystem. In my case, removal of this header would completely break my app. It seemed like a heavy-handed change.