I am trying to set the Access-Control-Allow-Methods
header for options
and it appears currently that claudia-api-builder does not have the ability to set the http options response, like a GET
request would. See GET example below.
GET Example
api.get('/hard-coded-headers', function () {
return 'OK';
}, {success: {headers: {'Access-Control-Allow-Methods': 'GET, HEAD, OPTIONS'}}});
Furthermore ...
If this header value is set via aws-api-gateway -> resources -> OPTIONS > Integration Response
and then if you were to perform a claudia update
it would be overwritten back to its default state as seen below.
The claudia-api-builder
docs show that it supports API Gateway custom error responses but nothing for success.
I would like to be able to set options custom header responses like the way a GET request is handled. Is this possible?
Have you tried the new ApiResponse()
function?
api.get('/programmatic-headers', function () {
return new api.ApiResponse('OK', {'Access-Control-Allow-Methods': 'GET, HEAD, OPTIONS'}, 200);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With