-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use FALLBACK_ERROR_FORMAT for handlers that return empty() #2659
Conversation
… response format instead. Fix #2658
Codecov ReportBase: 88.583% // Head: 88.642% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2659 +/- ##
=============================================
+ Coverage 88.583% 88.642% +0.058%
=============================================
Files 87 87
Lines 6850 6850
Branches 1171 1171
=============================================
+ Hits 6068 6072 +4
+ Misses 540 538 -2
+ Partials 242 240 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
…pond to a content type.
This passed all tests, which means that we definitely need more tests. Will do on another PR, please merge this if OK! |
Linter check is failing on some unchanged files, cannot reproduce locally, all formatted OK here. |
Remove mapping of empty() to HTML, such that the fallback format will rather be used. Also removes mapping of
file
,redirect
and other untyped responses.This has effects on two separate cases:
json(data) if data else empty()
will receive json error format.When there is no format from route, due to nothing found or a conflict of formats, Sanic falls back FALLBACK_ERROR_FORMAT and other methods. Note that #2668 affects how that is done but does not fix the issue below.
Users affected by this (either now or after merged) are advised to either add
accept: application/json
or similar header to their request or to defineerror_format="json"
(text, html) on their routes, to get a specific format.Fix #2658