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
We are not able to run DELETE requests (or POST request with empty body), because the library always adds content-type: 'application/json' header and api doesn't consider an empty body a valid json (returns Body cannot be empty when content-type is set to 'application/json). Or is there some option in openAPI schema I'm missing to remove this? I was able to hack this by explicitly including content-type: 'text-plain' header to every DELETE request.
Example of the delete chunk in schema (simplified):
The error message Body cannot be empty when content-type is set to 'application/json' is unique to your endpoint, so I don’t think there’s a good default that can be changed here (for most endpoints, Content-Type: application/json helps endpoints return the correct response back as a default).
Also you can unset that default header for all endpoints with:
createClient({headers: {'Content-Type': null}});
But yes if you wanted to do something more complex such as send application/json for all endpoints by default, but omit that header for DELETE requests, then that’d probably have to be solved with upcoming middleware support (#1122)
Closing this issue as I think between the provided workaround, and new support for middleware, there are ways to solve this! But please correct me if I’m missing anything.
Description
We are not able to run DELETE requests (or POST request with empty body), because the library always adds
content-type: 'application/json'
header and api doesn't consider an empty body a valid json (returnsBody cannot be empty when content-type is set to 'application/json
). Or is there some option in openAPI schema I'm missing to remove this? I was able to hack this by explicitly includingcontent-type: 'text-plain'
header to every DELETE request.Example of the delete chunk in schema (simplified):
Reproduction
Expected result
Checklist
The text was updated successfully, but these errors were encountered: