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

Return 404 on none existing endpoint with resource embedding #3602

Open
DutchGerman opened this issue Jun 17, 2024 · 0 comments
Open

Return 404 on none existing endpoint with resource embedding #3602

DutchGerman opened this issue Jun 17, 2024 · 0 comments
Labels
bug http http compliance

Comments

@DutchGerman
Copy link

DutchGerman commented Jun 17, 2024

Environment

  • PostgreSQL version: 15.7
  • PostgREST version: 12.0.3
  • Operating system: Ubuntu 24.04

Description of issue

When making a request to a none existing endpoint that includes resource embedding, it returns an error 400.

GET /none_existing_endpoint?select=title,directors(id,last_name) HTTP/1.1

Response: 400 Bad Request
{
    "code": "PGRST200",
    "details": "Searched for a foreign key relationship between 'none_existing_endpoint' and 'directors' in the schema 'exposed', but no matches were found.",
    "hint": null,
    "message": "Could not find a relationship between 'none_existing_endpoint' and 'directors' in the schema cache"
}

I would expect an 404 that tells me that the endpoint itself does not exist like so:

GET /none_existing_endpoint?select=title,directors(id,last_name) HTTP/1.1

Response: 404 Bad Request
{
    "code": "42P01",
    "details": null,
    "hint": null,
    "message": "relation \"exposed.none_existing_endpoint\" does not exist"
}
@DutchGerman DutchGerman changed the title Return 404 on none existing endpoint with embedding Return 404 on none existing endpoint with resource embedding Jun 17, 2024
@wolfgangwalther wolfgangwalther added bug http http compliance labels Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug http http compliance
Development

No branches or pull requests

2 participants