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