feat: add actual user for trpc wss-dev-server (#261)

* feat: add actual user for trpc wss-dev-server #233

* chore: address pull request feedback

* fix: deepsource issue
This commit is contained in:
Meier Lukas
2024-03-25 18:57:59 +01:00
committed by GitHub
parent 87808c1349
commit 058a8c4776
15 changed files with 174 additions and 69 deletions

View File

@@ -0,0 +1,17 @@
export function parseCookies(cookieString: string) {
const list: Record<string, string> = {};
const cookieHeader = cookieString;
if (!cookieHeader) return list;
cookieHeader.split(";").forEach(function (cookie) {
const items = cookie.split("=");
let name = items.shift();
name = name?.trim();
if (!name) return;
const value = items.join("=").trim();
if (!value) return;
list[name] = decodeURIComponent(value);
});
return list;
}

View File

@@ -1,2 +1,3 @@
export * from "./object";
export * from "./string";
export * from "./cookie";