Skip to content

Commit

Permalink
Use FALLBACK_ERROR_FORMAT for handlers that return empty() (#2659)
Browse files Browse the repository at this point in the history
Co-authored-by: L. Karkkainen <tronic@users.noreply.github.com>
Co-authored-by: Adam Hopkins <adam@amhopkins.com>
  • Loading branch information
3 people committed Feb 5, 2023
1 parent 9cb9e88 commit c7a71cd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions sanic/errorpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,16 +406,13 @@ def escape(text):
v: k for k, v in RENDERERS_BY_CONTENT_TYPE.items()
}

# Handler source code is checked for which response types it returns with the
# route error_format="auto" (default) to determine which format to use.
RESPONSE_MAPPING = {
"empty": "html",
"json": "json",
"text": "text",
"raw": "text",
"html": "html",
"file": "html",
"file_stream": "text",
"stream": "text",
"redirect": "html",
"JSONResponse": "json",
"text/plain": "text",
"text/html": "html",
"application/json": "json",
Expand Down

0 comments on commit c7a71cd

Please sign in to comment.