-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Traceback HTML not shown in browsable API #4042
Comments
I'm also hitting this problem. Whenever I'm doing POST/PUT requests in browsable API and it fails with 500 then a GET request is automatically fired against the same url and that's what I'm going to see in the browser. The stack trace is still logged in my log file. Also if GET request fails then the correct django full debug/stacktrace error page is shows and no extra requests are fired. Have not been able to figure out the problem Running django 1.7.x and rest 3.3.3 |
After migrating from django 1.7.1 / rest 2.3.13 to django 1.8.12 / rest 3.3.3 |
Agree that this would be an improvement, yup. |
I have added a patch for this. Please share your thoughts. #4172 |
@akarambir Not convinced that'd actually fix things, as I don't think it's where the issue is, tho I could be wrong. If you've confirmed that the change does result in fixing the required behavior then I'll reopen as described on the ticket. Thanks! |
@tomchristie Problem is in Browsable API only because Ajax Calls in Debug Mode gets response in text/plain from django and rest's xhr redirects it as it is not text/html. Please check code at following lines: https://github.com/django/django/blob/stable/1.10.x/django/views/debug.py#L80 |
@anoopmalav - That makes sense, yup. Thanks. 👍 |
@anoopmalav thanks for the comment there, very helpful when reviewing this! Good work folks. ✨ |
In the browsable API, when I submit a form and it causes a 500 error, the page gets reloaded instead of showing Django's 500 template.
For ajax requests, the 500 response is sent in plain text (https://github.com/django/django/blob/master/django/views/debug.py#L74) and in the browsable api, the page is redirected to itself when the response is not in HTML (https://github.com/tomchristie/django-rest-framework/blob/566812ac0b577f79801ec67f86f064cf39ebee01/rest_framework/static/rest_framework/js/ajax-form.js#L65)
It would be great to show the error details somehow.
The text was updated successfully, but these errors were encountered: