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

Nonexistent api routes respond with HTML instead of JSON #11166

Closed
jacobtylerwalls opened this issue Jul 11, 2024 · 0 comments · Fixed by #11167
Closed

Nonexistent api routes respond with HTML instead of JSON #11166

jacobtylerwalls opened this issue Jul 11, 2024 · 0 comments · Fixed by #11167
Assignees
Labels

Comments

@jacobtylerwalls
Copy link
Member

  • Visit an invalid api route

Result: Django debug page (or "Not Found" template if DEBUG = False)
Expected: JSON payload


The Django debug page is great for development, because it lists routes to aid in debugging. But if you/your application visits an invalid route, I'm suggesting it would be better to return JSON that is parsable by the frontend.

For example, I think this:

json-response

... would be preferable to this (current):

html-response
@jacobtylerwalls jacobtylerwalls self-assigned this Jul 11, 2024
@jacobtylerwalls jacobtylerwalls linked a pull request Jul 11, 2024 that will close this issue
11 tasks
jacobtylerwalls added a commit that referenced this issue Jul 11, 2024
apeters added a commit that referenced this issue Aug 13, 2024
Respond to invalid api routes with JSON #11166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant