sat-utils/sat-api

Compress response payload ?

Closed this issue · 0 comments

Each stac item could be quite large and for now we return the geojson in plain text in

const buildResponse = (statusCode, body) => ({
isBase64Encoded: false,
statusCode,
body,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*', // Required for CORS support to work
'Access-Control-Allow-Credentials': true
}
})

I think we could add payload compression if the client accept it (headers should have "Accept-Encoding: br, gzip, deflate"). Theoretically we could ship a payload up to 6Mb which will contain a way more data than the non-compressed response.

edit:
adding for references that sometime headers can return "accept-encoding" or "Accept-Encoding"
vincentsarago/lambda-proxy#6 (comment)

cc @matthewhanson