mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
fix passing set-cookie from api response
This commit is contained in:
+7
-2
@@ -22,8 +22,13 @@ const handler = async(nextReq: NextApiRequest, nextRes: NextApiResponse) => {
|
||||
);
|
||||
|
||||
// proxy some headers from API
|
||||
nextRes.setHeader('x-request-id', apiRes.headers.get('x-request-id') || '');
|
||||
nextRes.setHeader('set-cookie', apiRes.headers.get('set-cookie') || '');
|
||||
const requestId = apiRes.headers.get('x-request-id');
|
||||
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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user