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'd like response to always be a Response regardless of what HTTP status code was returned. Is this possible?
(a) seems to be addressed by handleError but I cannot figure out how to achieve (b). I've tried every combination of handleError, afterFetch, etc I can think of but I can never seem to get the body of an error response back (e.g. if /endpoint returns a 4xx.
Looking at the code, the issue seems to be that .then(handleStatus) is always called. And handleStatus converts that Response to an Error, losing all the info from the Response
Do I have that correct? Either way, can you suggest any way to achieve what I'm describing?
Edit: I now see that getting the Response would be a bigger change than skipping handleStatus. IIUC, skipping handleStatuswould allow access to the processed body though
The text was updated successfully, but these errors were encountered:
I want to a) not throw an error when
!response.ok
b) have full access to theResponse
(statusText
,body
,headers
) etce.g. given
I'd like
response
to always be aResponse
regardless of what HTTP status code was returned. Is this possible?(a) seems to be addressed by
handleError
but I cannot figure out how to achieve (b). I've tried every combination ofhandleError
,afterFetch
, etc I can think of but I can never seem to get the body of an error response back (e.g. if/endpoint
returns a 4xx.Looking at the code, the issue seems to be that
.then(handleStatus)
is always called. AndhandleStatus
converts thatResponse
to anError
, losing all the info from theResponse
Do I have that correct? Either way, can you suggest any way to achieve what I'm describing?
Edit: I now see that getting the
Response
would be a bigger change than skippinghandleStatus
. IIUC, skippinghandleStatus
would allow access to the processed body thoughThe text was updated successfully, but these errors were encountered: