diff --git a/tornado_openapi3/responses.py b/tornado_openapi3/responses.py index cdb6e1f..534f246 100644 --- a/tornado_openapi3/responses.py +++ b/tornado_openapi3/responses.py @@ -13,7 +13,7 @@ class TornadoResponseFactory: def create(cls, response: HTTPResponse) -> OpenAPIResponse: mimetype = response.headers.get("Content-Type", "text/html") return OpenAPIResponse( - data=response.body.decode("utf-8"), + data=response.body.decode("utf-8") if response.body else "", status_code=response.code, mimetype=mimetype, )