It seems to me that the default response handler for fetchBaseQuery is "json". As far as I can tell, this is equivalent to parsing the response as text, and then doing JSON.parse on the text after checking its' length. This is not really documented properly anywhere to my knowledge, I figured it out by scanning through the source code.
My original assumption was that the default response handler was async (res) => await res.json()
When implementing a wrapper response handler it's a bit cumbersome and hard to figure out that what I need to actually reimplement to mirror the behavior is this:
It seems to me that the default response handler for
fetchBaseQuery
is"json"
. As far as I can tell, this is equivalent to parsing the response as text, and then doingJSON.parse
on the text after checking its' length. This is not really documented properly anywhere to my knowledge, I figured it out by scanning through the source code.My original assumption was that the default response handler was
async (res) => await res.json()
When implementing a wrapper response handler it's a bit cumbersome and hard to figure out that what I need to actually reimplement to mirror the behavior is this:
I suggest exporting the above function as a
defaultResponseHandler
, so that wrappers can be easily created as such: