openapi-react-query does not propagate undefined
errors from openapi-fetch
#2070
Labels
bug
Something isn't working
good first issue
Straightforward problem, solvable for first-time contributors without deep knowledge of the project
openapi-react-query
Relevant to openapi-react-query
openapi-fetch may return an error of value
undefined
, when content length is 0 and response is not okay:openapi-typescript/packages/openapi-fetch/src/index.js
Lines 205 to 208 in d4689b1
However, openapi-react-query does not propagate this error, because the error is only propagated when
error
is truthy, as per this code:openapi-typescript/packages/openapi-react-query/src/index.ts
Lines 118 to 120 in d4689b1
To fix this, I believe this
if (error)
check should beif (!response.ok)
and/orif ('error' in result)
.We might also want to consider whether it makes sense for openapi-fetch to return
undefined
as an error, in the scenario mentioned above.The text was updated successfully, but these errors were encountered: