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

Disable default white-label error pages #307

Merged
merged 3 commits into from
Feb 20, 2024
Merged

Disable default white-label error pages #307

merged 3 commits into from
Feb 20, 2024

Conversation

dabico
Copy link
Member

@dabico dabico commented Feb 20, 2024

Instead of returning the default HTML, which is inconsistent with the site's style, we should just return the HTTP status code. API routes are not meant to be consumed through the browser anyway, so we should not care about how the browser renders the responses.

This also fixes a minor issue that would surface whenever the API redirected to /error. The default view engine set up to serve these HTML files would complain about circular references. However, since we no longer render any HTML, the error has been removed.

Intended to override `BasicErrorController`. This controller only
returns the status code, as opposed to the HTML which is the default
error controller behaviour. To prevent confusion that may stem from
manually navigating to `/api/error`, the route is instructed to return
a 404 not found. In case of other errors, the appropriate status code
will be returned instead.
@dabico dabico merged commit 44015a0 into master Feb 20, 2024
5 checks passed
@dabico dabico deleted the enhancement/errors branch February 20, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant