UNPKG

@graphql-mesh/utils

Version:
15 lines (14 loc) 415 B
// withCookies - embeds cookies object into the request export const withCookies = (request) => { request.cookies = {}; try { request.cookies = (request.headers.get('Cookie') || '') .split(/;\s*/) .map(pair => pair.split(/=(.+)/)) .reduce((acc, [key, value]) => { acc[key] = value; return acc; }, {}); } catch (err) { } };