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
With an as: 'json' interceptor, Proxy attempts to JSON.parse the response body, regardless of response.statusCode. Ideally, this would be skipped and the interceptor callback would be called with some indication of the 304 status code and response.json as undefined. Even better, would be an interceptor filter on response.statusCode for response and response-sent phases. Just a thought!
The text was updated successfully, but these errors were encountered:
In any case, Hoxy doesn't have the ability to filter on status code but that definitely seems like a useful feature, and fits with how filtering is done in general. It wouldn't be hard to add. Then you could do:
I agree that the server shouldn't send a application/json mimeType for a 304, but unfortunately the server I'm working with tends to do just that, and I don't control that server.
I'll try to carve out some time to put a PR together for the statusCode filtering, as well as overall better handling of empty/invalid bodies with as: 'json' interceptors.
I agree that the server shouldn't send a application/json mimeType for a 304, but unfortunately the server I'm working with tends to do just that, and I don't control that server.
With an
as: 'json'
interceptor, Proxy attempts toJSON.parse
the response body, regardless ofresponse.statusCode
. Ideally, this would be skipped and the interceptor callback would be called with some indication of the 304 status code andresponse.json
asundefined
. Even better, would be an interceptor filter onresponse.statusCode
forresponse
andresponse-sent
phases. Just a thought!The text was updated successfully, but these errors were encountered: