How to use the tough-cookie.parse function in tough-cookie

To help you get started, we’ve selected a few tough-cookie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meetup / meetup-web-platform / packages / mwp-test-utils / src / index.js View on Github external
export const parseCookieHeader = cookieHeader => {
	const cookies =
		cookieHeader instanceof Array
			? cookieHeader.map(Cookie.parse)
			: [Cookie.parse(cookieHeader)];

	return cookies.reduce(
		(acc, cookie) => ({ ...acc, [cookie.key]: cookie.value }),
		{}
	);
};
github kevva / screenshot-stream / screenshot.js View on Github external
return Promise.all(cookies.map(x => {
			const cookie = typeof x === 'string' ? toughCookie.parse(x).toJSON() : x;

			return this.page.setCookie(Object.assign(cookie, {
				name: cookie.name || cookie.key
			}));
		}));
	}