mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-11-23 11:09:56 +00:00
Use None for no request body instead of b""
This is how openapi-core expects a lack of request body. Currently it can cause issues with validation because requests without a body will be send to the validator with a request a body of empty bytes that can't be validated.
This commit is contained in:
parent
ae0b8c09b4
commit
3dce6ca7b5
2 changed files with 3 additions and 3 deletions
|
@ -99,7 +99,7 @@ class TestRequestFactory(unittest.TestCase):
|
|||
full_url_pattern=url,
|
||||
method="get",
|
||||
parameters=RequestParameters(query=ImmutableMultiDict(parameters)),
|
||||
body=b"",
|
||||
body=None,
|
||||
mimetype="application/x-www-form-urlencoded",
|
||||
)
|
||||
openapi_request = TornadoRequestFactory.create(tornado_request)
|
||||
|
@ -127,7 +127,7 @@ class TestRequestFactory(unittest.TestCase):
|
|||
parameters=RequestParameters(
|
||||
query=ImmutableMultiDict(parameters), path={}, cookie={}
|
||||
),
|
||||
body=b"",
|
||||
body=None,
|
||||
mimetype="application/x-www-form-urlencoded",
|
||||
)
|
||||
openapi_request = TornadoRequestFactory.create(tornado_request)
|
||||
|
|
|
@ -55,7 +55,7 @@ class TornadoRequestFactory:
|
|||
header=Headers(request.headers.get_all()),
|
||||
cookie=parse_cookie(request.headers.get("Cookie", "")),
|
||||
),
|
||||
body=request.body if request.body else b"",
|
||||
body=request.body if request.body else None,
|
||||
mimetype=parse_mimetype(
|
||||
request.headers.get("Content-Type", "application/x-www-form-urlencoded")
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue