We can set/remove headers, but we can’t get headers list from response, because response object comes empty (like { }).
How can I get all set-cookie headers from response object in ResponseWriter?
code example:
import { RouteHandler } from ‘@layer0/core/router/Router’;
import { HTTP_HEADERS } from “@layer0/core”;
import transformResponse from ‘…/transform’;
const handler: RouteHandler = async (obj) => {
const {
cache,
removeUpstreamResponseHeader,
updateResponseHeader,
setResponseHeader,
proxy,
updateUpstreamResponseHeader,
request,
response,
} = obj;
console.log('Current response → ', response)
setResponseHeader(HTTP_HEADERS.cacheControl, ‘public, max-age=86400’); // change the cache headers to be cachable
proxy(‘origin’, { transformResponse });
}
export default handler;
Thanks