I am returning a small csv file from a call via API gateway and I would like to dynamically set the filename but I cannot figure out how to do it.
If I hardcode the filename then it works ok when I set the content disposition, but ideally I would like to take one of the request parameters which is an ID used for the lookup and add this to the filename.
Firstly, is this even possible? All of my attempts end up with a literal string being rendered and there is no variable interpolation.
Here is an example of what I am trying to do:
integration: lambda
response:
headers:
Content-Type: "'text/csv'"
Content-Disposition: "'attachment; filename=filename_$context.requestOverride.querystring.my_var_$context.requestTime.csv'"
My-Header: context.path
Can this be done and if so could someone show me how please?