Skip to content
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

Provide 404 response on RESTified endpoints if response is empty #10184

Open
typhonius opened this issue Mar 30, 2024 · 1 comment
Open

Provide 404 response on RESTified endpoints if response is empty #10184

typhonius opened this issue Mar 30, 2024 · 1 comment
Labels
k/enhancement New feature or improve an existing feature

Comments

@typhonius
Copy link
Contributor

Is your proposal related to a problem?

RESTified endpoints currently return 200 for every response in a manner congruent with the GraphQL specification rather than following REST rules which would preordain a 4xx response

Describe the solution you'd like

When an empty response is returned from Hasura via a RESTified endpoint, I would like it to return 404

This could be placed behind a feature flag or environment variable or made user configurable. This will help data access requests via Hasura and REST to align to expectations of API consumers

@typhonius typhonius added the k/enhancement New feature or improve an existing feature label Mar 30, 2024
@bureku
Copy link

bureku commented Apr 1, 2024

A general rule of "empty response" == 404 might not be accurate to meet the expectation of REST specifications.
e.g. if it's a search endpoint POST /search, a 200 response with an empty body or array is fine. However, if the endpoint explicitly ask for a specific resource GET /customers/{id}, then it is expected to return 404 if that resource is not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants