Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created July 28, 2022 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianleroux/368c0fe0451aabcb5bfe1b569d418a5a to your computer and use it in GitHub Desktop.
Save brianleroux/368c0fe0451aabcb5bfe1b569d418a5a to your computer and use it in GitHub Desktop.
make api gateway send back rest api style req/res
/**
* this incantation will set the HttpApi response payload
* format to 1.0 which enables multiple headers
* https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.response
*/
module.exports = {
deploy: {
async start ({ arc, cloudformation }) {
if (!arc) console.log('missing arc')
let base = cloudformation.Resources.HTTP.Properties.DefinitionBody.paths['/']
base.get['x-amazon-apigateway-integration'].payloadFormatVersion = '1.0'
let base2 = cloudformation.Resources.HTTP.Properties.DefinitionBody.paths['/notes/{entryID}']
base2.get['x-amazon-apigateway-integration'].payloadFormatVersion = '1.0'
return cloudformation
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment