I could set single http response header through api gateway integration response header mapping.
in that case i was giving context.fail("http://www.google.com")
response from aws lambda and use regex (".http.") to identify the response and finally map it to my header like thisLocation: integration.response.body.errorMessage
.
This is working when i try to map a single header at a time.
But i want to set both Location and Cookie headers in a single response.
to achieve this, i returned a json from my aws lambda like
context.fail(JSON.stringify({Location:"http://www.google.com",Cookie: vid="233kwer34343"}))
but i couldn't map headers via integration.response.body.errorMessage.Location
and integration.response.body.errorMessage.Cookie
It is possible to do this by using context.succeed()
instead of context.fail()
. but this is not checking regex. i want to check regex for categorizing responses.
What is the best way to map multiple response headers from lambda response body?