Add a tornado-specific validator for convenience

This commit is contained in:
Correl Roush 2020-11-20 12:00:43 -05:00
parent e80db27aa9
commit c81019df96

View file

@ -4,6 +4,7 @@ from openapi_core.validation.request.datatypes import ( # type: ignore
RequestParameters, RequestParameters,
OpenAPIRequest, OpenAPIRequest,
) )
from openapi_core.validation.request import validators # type: ignore
from tornado.httputil import HTTPServerRequest from tornado.httputil import HTTPServerRequest
from werkzeug.datastructures import ImmutableMultiDict, Headers from werkzeug.datastructures import ImmutableMultiDict, Headers
@ -34,3 +35,8 @@ class TornadoRequestFactory:
"Content-Type", "application/x-www-form-urlencoded" "Content-Type", "application/x-www-form-urlencoded"
), ),
) )
class RequestValidator(validators.RequestValidator):
def validate(self, request: HTTPServerRequest):
return super().validate(TornadoRequestFactory.create(request))