-
-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(errors): default error serializer content negotiation (#2190)
* Add unit test for default_serialize_json * Extract options to variables for improved readability * Extract prefered response content type negotiation to function * Use media handlers to serialize errors by accepted content type * refactor: remove use of ordered dict since it's no longer required * feat: add content_type to testing result * chore: improve implementation * docs: add news fragment * chore: add missing tests and improve docs * fix: take into account async only handlers * chore: fix mypy errors * chore: simplify code a bit, avoiding unnecessary complexity * fix: avoid change to app code * chore: review feedback * fix: properly account for q= when parting the accept header * docs(newsfragments): improve spelling/grammar * docs(newsfragments): revert changes to one newsfr since the impl was changed! --------- Co-authored-by: Federico Caselli <cfederico87@gmail.com> Co-authored-by: Vytautas Liuolia <vytautas.liuolia@gmail.com>
- Loading branch information
1 parent
a0da915
commit 46b7fdd
Showing
9 changed files
with
205 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The default error serializer will now use the response media handlers | ||
to better negotiate the response serialization with the client. | ||
The implementation still defaults to JSON if the client does not indicate any | ||
preference. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Added :attr:`falcon.testing.Result.content_type` and | ||
:attr:`falcon.testing.StreamedResult.content_type` as a utility accessor | ||
for the ``Content-Type`` header. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters