Skip to content

openapi-react-query does not handle the server returning null #2000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gaborbernat opened this issue Nov 12, 2024 · 1 comment
Closed

openapi-react-query does not handle the server returning null #2000

gaborbernat opened this issue Nov 12, 2024 · 1 comment
Labels
enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library

Comments

@gaborbernat
Copy link

When the server returns null (which is a valid thing, because e.g. has no payload to send) openapi-react-query handles that as an error, even though the server returned with 200.

The reason behind this is https://github.com/openapi-ts/openapi-typescript/blob/main/packages/openapi-react-query/src/index.ts#L118-L121, here this should be:

    if (error || data === undefined) {
      throw error;
    }
    return data;
@gaborbernat gaborbernat added enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library labels Nov 12, 2024
@kerwanp
Copy link
Contributor

kerwanp commented Nov 13, 2024

Hi, this is duplicate of #1973 and a PR is currently opened #1975

@kerwanp kerwanp closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library
Projects
None yet
Development

No branches or pull requests

2 participants