Get mimetype from header

This commit is contained in:
Correl Roush 2020-11-19 19:37:58 -05:00
parent aa9e595fa9
commit e80db27aa9
2 changed files with 4 additions and 2 deletions

View file

@ -89,7 +89,7 @@ class TestRequestFactory(unittest.TestCase):
method="get",
parameters=RequestParameters(query=ImmutableMultiDict([("bar", "baz")])),
body="",
mimetype="text/html",
mimetype="application/x-www-form-urlencoded",
)
openapi_request = TornadoRequestFactory.create(tornado_request)
self.assertEqual(attr.asdict(expected), attr.asdict(openapi_request))

View file

@ -30,5 +30,7 @@ class TornadoRequestFactory:
query=query_arguments, header=Headers(request.headers.get_all())
),
body=request.body.decode("utf-8"),
mimetype="text/html",
mimetype=request.headers.get(
"Content-Type", "application/x-www-form-urlencoded"
),
)