Created
July 28, 2022 19:09
-
-
Save brianleroux/368c0fe0451aabcb5bfe1b569d418a5a to your computer and use it in GitHub Desktop.
make api gateway send back rest api style req/res
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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