Skip to content

Commit

Permalink
make Request.body always be a dict
Browse files Browse the repository at this point in the history
  • Loading branch information
raylu committed Apr 8, 2024
1 parent e0d5b36 commit f2a97b8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pigwig/pigwig.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def build_request(self, environ: dict) -> tuple[Request, Exception | None]:
query: Mapping[str, list[str] | str] = {}
headers = HTTPHeaders()
cookies = http.cookies.SimpleCookie()
body: tuple | dict | None = None
body = {}
err = None

try:
Expand All @@ -174,7 +174,6 @@ def build_request(self, environ: dict) -> tuple[Request, Exception | None]:
content_length = int(content_length_str)
else:
content_length = None
body = (environ['wsgi.input'], content_length)
content_type = environ.get('CONTENT_TYPE')
if content_type:
headers['Content-Type'] = content_type
Expand Down
2 changes: 1 addition & 1 deletion pigwig/request_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Request:
"""

def __init__(self, app: PigWig, method: str, path: str, query: typing.Mapping[str, str | list[str]],
headers: HTTPHeaders, body: tuple | dict | None, cookies: http.cookies.BaseCookie,
headers: HTTPHeaders, body: dict, cookies: http.cookies.BaseCookie,
wsgi_environ: dict[str, typing.Any]) -> None:
self.app = app
self.method = method
Expand Down

0 comments on commit f2a97b8

Please sign in to comment.