You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've just been building a restful API and am testing it with curl.
I have debugtoolbar enabled and 500 errors come through as a full web page which isn't at all easy to read.
The obvious solution is to disable debugtoolbar but it would still be nice to show plain text output for obvious CLI requests eg. curl, wget, httpie in case people use curl with dbtb switched on.
Alternatively there could be a white list of browser user-agents to show HTML response for or use content-type, but that all seems error prone.
The text was updated successfully, but these errors were encountered:
I'll create a PR if I get a chance, however I really think User-Agent is a better field to decide with than Content-Type.
That's kind of the point in User-Agent - to tell the server what kind of application is making the request.
It's likely that when using CLI apps to make requests people will mess with the content-type as it's regularly used by servers to decide what to do.
In time I guess we could use content-type checking too, but let's do the simplest thing first then make it more complicated when we have to.
I also noticed that even with debugtoolbar switched off (or I guess exception interception disabled) the debug response from aiohttp is encoded as HTML (even if it's very simple) so this change would be useful even in that situation.
I've just been building a restful API and am testing it with curl.
I have debugtoolbar enabled and 500 errors come through as a full web page which isn't at all easy to read.
The obvious solution is to disable debugtoolbar but it would still be nice to show plain text output for obvious CLI requests eg.
curl
,wget
,httpie
in case people use curl with dbtb switched on.Alternatively there could be a white list of browser user-agents to show HTML response for or use
content-type
, but that all seems error prone.The text was updated successfully, but these errors were encountered: