Commit c2f67dd7 authored by tom's avatar tom

fix passing set-cookie from api response

parent 7b19b089
...@@ -22,8 +22,13 @@ const handler = async(nextReq: NextApiRequest, nextRes: NextApiResponse) => { ...@@ -22,8 +22,13 @@ const handler = async(nextReq: NextApiRequest, nextRes: NextApiResponse) => {
); );
// proxy some headers from API // proxy some headers from API
nextRes.setHeader('x-request-id', apiRes.headers.get('x-request-id') || ''); const requestId = apiRes.headers.get('x-request-id');
nextRes.setHeader('set-cookie', apiRes.headers.get('set-cookie') || ''); requestId && nextRes.setHeader('x-request-id', requestId);
const setCookie = apiRes.headers.raw()['set-cookie'];
setCookie?.forEach((value) => {
nextRes.appendHeader('set-cookie', value);
});
nextRes.status(apiRes.status).send(apiRes.body); nextRes.status(apiRes.status).send(apiRes.body);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment