From 151141d98a5edca8cfd767b78aa9ce99ad25b582 Mon Sep 17 00:00:00 2001 From: khamaileon Date: Sun, 7 Aug 2022 15:05:29 +0200 Subject: [PATCH] :adhesive_bandage: Add vnd.oai.openapi to mime type list that are not base64 encoded (#271) --- docs/adapter.md | 1 - docs/http.md | 5 ++--- mangum/handlers/utils.py | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/adapter.md b/docs/adapter.md index a94718d6..6801fb20 100644 --- a/docs/adapter.md +++ b/docs/adapter.md @@ -7,7 +7,6 @@ handler = Mangum( app, lifespan="auto", api_gateway_base_path=None, - text_mime_types=None, ) ``` diff --git a/docs/http.md b/docs/http.md index 24405366..bf6e2eed 100644 --- a/docs/http.md +++ b/docs/http.md @@ -33,14 +33,13 @@ Binary responses are determined using the `Content-Type` and `Content-Encoding` ### Text MIME types -By default, all response data will be [base64 encoded](https://docs.python.org/3/library/base64.html#base64.b64encode) and include `isBase64Encoded=True` in the response ***except*** the default text MIME types and any MIME types included in the `TEXT_MIME_TYPES` list setting. - -The following types are excluded from binary responses by default: +By default, all response data will be [base64 encoded](https://docs.python.org/3/library/base64.html#base64.b64encode) and include `isBase64Encoded=True` in the response ***except*** the following MIME types: - `application/json` - `application/javascript` - `application/xml` - `application/vnd.api+json` +- `application/vnd.oai.openapi` Additionally, any `Content-Type` header prefixed with `text/` is automatically excluded. diff --git a/mangum/handlers/utils.py b/mangum/handlers/utils.py index 1ec1dfb6..91b84c16 100644 --- a/mangum/handlers/utils.py +++ b/mangum/handlers/utils.py @@ -11,6 +11,7 @@ "application/javascript", "application/xml", "application/vnd.api+json", + "application/vnd.oai.openapi", ]