mirror of
https://github.com/correl/tornado-openapi3.git
synced 2024-12-29 19:15:07 +00:00
Handle unset response bodies
This commit is contained in:
parent
2b2b423b7b
commit
98d112369f
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ class TornadoResponseFactory:
|
||||||
def create(cls, response: HTTPResponse) -> OpenAPIResponse:
|
def create(cls, response: HTTPResponse) -> OpenAPIResponse:
|
||||||
mimetype = response.headers.get("Content-Type", "text/html")
|
mimetype = response.headers.get("Content-Type", "text/html")
|
||||||
return OpenAPIResponse(
|
return OpenAPIResponse(
|
||||||
data=response.body.decode("utf-8"),
|
data=response.body.decode("utf-8") if response.body else "",
|
||||||
status_code=response.code,
|
status_code=response.code,
|
||||||
mimetype=mimetype,
|
mimetype=mimetype,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue