forked from marshmallow-code/webargs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Go back to treating empty JSON body as {}
load_* methods are now expected to return `missing` or {} when data is missing for the given location. e.g. When a JSON body is "" it should be `missing`. This is still considered correct. However, in terms of the external behavior of webargs, go back to the webargs v5.x stance on marshmallow-code#297 and optional JSON data: no data should be interpreted as `{}`. In order to achieve this, the wrapper which calls the various "loader_func"s to load location data explicitly checks the result for `missing` and converts it to `{}` if it is missing. This makes it easy to use webargs to implement an API with optional JSON data, but internally preserves the ability to detect a missing JSON payload and distinguish it from a payload containing `{}`. Revert changes to the regression test for marshmallow-code#297 , and a similar test.
- Loading branch information
Showing
4 changed files
with
28 additions
and
20 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
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