You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm dealing with an API that expects a Content-Type: application/json even for a DELETE request without a body, so the existing implementation doesn't work here. I'm working around that by explicitly setting the header on every json: true request, of which there are many littered through this application.
I suggest changing the implementation to make the !self.hasHeader('content-type') check independent of the self.body check, so if val is a boolean, try to set the header, ignoring the missing body.
If that's acceptable, I can look into creating a patch, at least the implementation change should be straight forward.
The text was updated successfully, but these errors were encountered:
Thanks @simov. I've created a pull request, #1772, that makes the change and updates tests. I think the existing tests cover the usecase well enough, so I didn't add a new one.
Documentation for the
json
options says:This doesn't work for
json: true
:The actual implementation also checks for
self.body
:I'm dealing with an API that expects a
Content-Type: application/json
even for a DELETE request without a body, so the existing implementation doesn't work here. I'm working around that by explicitly setting the header on everyjson: true
request, of which there are many littered through this application.I suggest changing the implementation to make the
!self.hasHeader('content-type')
check independent of theself.body
check, so ifval
is a boolean, try to set the header, ignoring the missing body.If that's acceptable, I can look into creating a patch, at least the implementation change should be straight forward.
The text was updated successfully, but these errors were encountered: