Skip to content

Commit

Permalink
Fix: Service responses are not compressed (#6360)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirho-ucsc committed Jul 19, 2024
1 parent e4eaade commit c362008
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion lambdas/indexer/.chalice/config.json.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"manage_iam_role": False,
"iam_role_arn": "${aws_iam_role.%s.arn}" % app_name,
"environment_variables": config.lambda_env,
"minimum_compression_size": config.minimum_compression_size,
"lambda_timeout": config.api_gateway_lambda_timeout,
"lambda_memory_size": 128,
**chalice.vpc_lambda_config(app_name),
Expand Down
1 change: 0 additions & 1 deletion lambdas/service/.chalice/config.json.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"manage_iam_role": False,
"iam_role_arn": "${aws_iam_role.%s.arn}" % app_name,
"environment_variables": config.lambda_env,
"minimum_compression_size": config.minimum_compression_size,
"lambda_timeout": config.api_gateway_lambda_timeout,
"lambda_memory_size": 2048,
**chalice.vpc_lambda_config(app_name),
Expand Down
6 changes: 6 additions & 0 deletions src/azul/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,12 @@ def tf_config(self, app_name):
del deployment['lifecycle']
deployment['triggers'] = {'redeployment': deployment.pop('stage_description')}

swagger_doc = json.loads(locals[app_name])
swagger_doc.update({
'x-amazon-apigateway-minimum-compression-size': config.minimum_compression_size
})
locals[app_name] = json.dumps(swagger_doc)

return {
'resource': resources,
'data': data,
Expand Down
9 changes: 7 additions & 2 deletions test/test_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ def app(self, spec):
return AzulChaliceApp('testing', '/app.py', spec=spec)

def test_top_level_spec(self):
spec = {'foo': 'bar'}
spec = {
'foo': 'bar',
}
app = self.app(spec)
self.assertEqual(app._specs, {'foo': 'bar', 'paths': {}}, "Confirm 'paths' is added")
self.assertEqual(app._specs, {
'foo': 'bar',
'paths': {}
}, "Confirm 'paths' is added")
spec['new key'] = 'new value'
self.assertNotIn('new key', app.spec(), 'Changing input object should not affect specs')

Expand Down

0 comments on commit c362008

Please sign in to comment.