fix: improve unified settings (#3160)

This commit is contained in:
David Nguyen
2026-08-10 14:57:19 +10:00
committed by GitHub
parent fc95ee9ead
commit 797f5c0e79
24 changed files with 129 additions and 114 deletions
+4 -1
View File
@@ -1,10 +1,13 @@
/**
* Todo: Use library for cookies instead.
*
* Server-side counterpart of `extractCookieFromDocument`, keep their matching
* semantics in step.
*/
export const extractCookieFromHeaders = (cookieName: string, headers: Headers): string | null => {
const cookieHeader = headers.get('cookie') || '';
const cookiePairs = cookieHeader.split(';');
const cookie = cookiePairs.find((pair) => pair.trim().startsWith(cookieName));
const cookie = cookiePairs.find((pair) => pair.trim().startsWith(`${cookieName}=`));
if (!cookie) {
return null;