Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should I enable compressed response from my API using Chalice #822

Closed
irr opened this issue May 3, 2018 · 1 comment
Closed

How should I enable compressed response from my API using Chalice #822

irr opened this issue May 3, 2018 · 1 comment

Comments

@irr
Copy link

irr commented May 3, 2018

Hi,

Is there any configuration or steps that I should do to get my compressed response?

from chalice import Chalice, Response
import json

app = Chalice(app_name='chapp')

@app.route('/')
def index():
    return Response(body=json.dumps(app.current_request.to_dict()),
                    status_code=200,
                    headers={'Content-Type': 'application/json'})

I tried using this sample code and it is not working. After deployed I use the following command to enable compression:

aws apigateway update-rest-api --rest-api-id 2z.... --patch-operations op=replace,path=/minimumCompressionSize,value='0'

<----------------------- begin (output)
{
"apiKeySource": "HEADER",
"name": "chapp",
"endpointConfiguration": {
"types": [
"EDGE"
]
},
"minimumCompressionSize": 0,
"version": "1.0",
"createdDate": 1524781284,
"binaryMediaTypes": [
"application/octet-stream",
"application/x-tar",
"application/zip",
"audio/basic",
"audio/ogg",
"audio/mp4",
"audio/mpeg",
"audio/wav",
"audio/webm",
"image/png",
"image/jpg",
"image/jpeg",
"image/gif",
"video/ogg",
"video/mpeg",
"video/webm"
],
"id": "2z..."
}
<----------------------- end (output)

Is it possible to enable compression in .chalice/config.json?

Thanks in advance.

@joguSD
Copy link
Contributor

joguSD commented May 6, 2018

This isn't currently possible through the config.json. There's an open feature request for this here: #672.
Closing as duplicate.

@joguSD joguSD closed this as completed May 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants