mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-11-14 19:19:32 +00:00
Include cookies in the Request validation
This commit is contained in:
parent
2b57d71113
commit
4896a5d5e0
2 changed files with 7 additions and 3 deletions
|
@ -124,7 +124,9 @@ class TestRequestFactory(unittest.TestCase):
|
|||
expected = OpenAPIRequest(
|
||||
full_url_pattern=url,
|
||||
method="get",
|
||||
parameters=RequestParameters(query=ImmutableMultiDict(parameters)),
|
||||
parameters=RequestParameters(
|
||||
query=ImmutableMultiDict(parameters), path={}, cookie={}
|
||||
),
|
||||
body=b"",
|
||||
mimetype="application/x-www-form-urlencoded",
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ from openapi_core.validation.request.datatypes import ( # type: ignore
|
|||
)
|
||||
from openapi_core.validation.request import validators # type: ignore
|
||||
from tornado.httpclient import HTTPRequest # type: ignore
|
||||
from tornado.httputil import HTTPServerRequest # type: ignore
|
||||
from tornado.httputil import HTTPServerRequest, parse_cookie # type: ignore
|
||||
from werkzeug.datastructures import ImmutableMultiDict, Headers
|
||||
|
||||
from .util import parse_mimetype
|
||||
|
@ -43,7 +43,9 @@ class TornadoRequestFactory:
|
|||
full_url_pattern=path,
|
||||
method=request.method.lower() if request.method else "get",
|
||||
parameters=RequestParameters(
|
||||
query=query_arguments, header=Headers(request.headers.get_all())
|
||||
query=query_arguments,
|
||||
header=Headers(request.headers.get_all()),
|
||||
cookie=parse_cookie(request.headers.get("Cookie", "")),
|
||||
),
|
||||
body=request.body if request.body else b"",
|
||||
mimetype=parse_mimetype(
|
||||
|
|
Loading…
Reference in a new issue