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
This library works great, but I have noticed issues with GET requests that have no request body on our backend API. The getFetchParams() always sends the Content-Type header as application\json, which throws the following error because the server expects a json body whenever that header is present:
"400 BadRequest: Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)"
We can manually override this by setting Content-Type to */* but it would be nice if it would check if there is body data before setting the content type header.
The text was updated successfully, but these errors were encountered:
CalebM1987
changed the title
Don't send application\json content-type header with empty body on
Don't send application\json content-type header with empty body on GET requests
Apr 1, 2022
This library works great, but I have noticed issues with
GET
requests that have no request body on our backend API. ThegetFetchParams()
always sends theContent-Type
header asapplication\json
, which throws the following error because the server expects a json body whenever that header is present:"400 BadRequest: Failed to decode JSON object: Expecting value: line 1 column 1 (char 0)"
We can manually override this by setting
Content-Type
to*/*
but it would be nice if it would check if there is body data before setting the content type header.Suggested Fix:
The text was updated successfully, but these errors were encountered: