Skip to content

Commit

Permalink
use optional args
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeane committed Oct 16, 2024
1 parent 709a1b7 commit 5443a6f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions flask_pydantic_spec/flask_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def request_validation(
) -> None:
raw_query = request.args or None
if raw_query is not None:
req_query = parse_multi_dict(raw_query, False)
req_query = parse_multi_dict(raw_query)
else:
req_query = {}
if request.content_type and "application/json" in request.content_type:
Expand All @@ -152,7 +152,7 @@ def request_validation(
)
elif request.content_type and "multipart/form-data" in request.content_type:
parsed_body = (
parse_multi_dict(request.form, True) if request.form else {}
parse_multi_dict(request.form, parse_json=True) if request.form else {}
)
else:
parsed_body = request.get_data() or {}
Expand Down
2 changes: 1 addition & 1 deletion flask_pydantic_spec/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def default_after_handler(
)


def parse_multi_dict(input: MultiDict, parse_json: bool) -> Dict[str, Any]:
def parse_multi_dict(input: MultiDict, parse_json: bool = False) -> Dict[str, Any]:
result = {}
for key, value in input.to_dict(flat=False).items():
if len(value) == 1 and parse_json:
Expand Down

0 comments on commit 5443a6f

Please sign in to comment.