openapi-core/openapi_core/contrib/falcon/responses.py

13 lines
410 B
Python
Raw Normal View History

"""OpenAPI core contrib falcon responses module"""
from openapi_core.validation.response.datatypes import OpenAPIResponse
class FalconOpenAPIResponseFactory(object):
@classmethod
def create(cls, resp):
return OpenAPIResponse(
data=resp.body,
status_code=resp.status[:3],
mimetype=resp.content_type.partition(";")[0] if resp.content_type else '',
)