gordon
gordon copied to clipboard
Cannot use double quotes in apigateway responses pattern
Hi,
I'm trying to create an apigateway using Gordon, and I want to use double quotes (") in the regex pattern used to decide what response code to return. Unfortunately, Gordon either over-escapes or under-escapes the pattern before it gives it to AWS, causing the stack creation to fail.
Here's the part of the created template that looks wrong to me:
"IntegrationResponses": [
{
"SelectionPattern": "",
"StatusCode": "201"
},
{
"SelectionPattern": ".*\"status\":400.*",
"StatusCode": "400"
},
{
"SelectionPattern": "*.\\\"errorMessage\\\".*",
"StatusCode": "500"
}
],
You can see the full template if you want to, and the relevant settings.yml. I've also created a repo which replicates the problem at https://github.com/jakul/gordon-regex-error.
The Amazon docs suggest that the correct format for regexes should be:
"SelectionPattern": ".*\\"status\\":400.*",
"SelectionPattern": "*.\\"errorMessage\\".*",
Can you take a look @jorgebastida ?
Cheers, Craig