fix(stac-api): avoid base64 encoding application/geo+json data #172
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using a REST API with a Lambda Proxy integration (such as when making use of our
PrivateLambdaApiGateway
, link), data that Mangum converts to base64 is not converted to text by the API Gateway.By default, Mangum v0.14.1 converts any text data to base64 aside from its builtin defaults1. These defaults do not include
application/geo+json
which is used by the STAC API. This PR upgrades Mangum (by utilizingstac-fastapi-pgstac
's unspecifiedmangum
version2) and configures Mangum to avoid converting any data to base64 that begins withtext/
orapplication/
.Question: Perhaps we should just disable the base64 conversion completely by specifying a text mime type of
''
which would match allmime_type in content_type
3 lookups?Footnotes
https://github.com/Kludex/mangum/blob/0.14.1/docs/http.md#text-mime-types ↩
https://github.com/stac-utils/stac-fastapi-pgstac/blob/d43ea548103d0e157d7e22fb70f9ea9fe310509b/setup.py#L49C6-L49C15 ↩
https://github.com/Kludex/mangum/blob/0.14.1/mangum/handlers/utils.py#L79 ↩