Skip to content

Commit

Permalink
Fix empty list in body (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
luolingchun authored Jun 16, 2024
1 parent 73b444d commit e01dc00
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flask_openapi3/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def _validate_header(header: Type[BaseModel], func_kwargs):
request_headers = dict(request.headers) or {}
request_headers = dict(request.headers)
for key, value in header.model_json_schema().get("properties", {}).items():
key_title = key.replace("_", "-").title()
# Add original key
Expand All @@ -20,7 +20,7 @@ def _validate_header(header: Type[BaseModel], func_kwargs):


def _validate_cookie(cookie: Type[BaseModel], func_kwargs):
request_cookies = dict(request.cookies) or {}
request_cookies = dict(request.cookies)
func_kwargs.update({"cookie": cookie.model_validate(obj=request_cookies)})


Expand Down Expand Up @@ -83,7 +83,7 @@ def _validate_form(form: Type[BaseModel], func_kwargs):


def _validate_body(body: Type[BaseModel], func_kwargs):
obj = request.get_json(silent=True) or {}
obj = request.get_json(silent=True)
if isinstance(obj, str):
body_model = body.model_validate_json(json_data=obj)
else:
Expand Down

0 comments on commit e01dc00

Please sign in to comment.