fix: harden share link dose operations and token reuse (#298)

* fix: harden share link dose operations and token reuse

* fix: restore share dose compatibility and add correlation helper
This commit is contained in:
Daniel Volz
2026-02-24 21:12:43 +01:00
committed by GitHub
parent f15c2dd79f
commit 63cd9ef19b
4 changed files with 220 additions and 30 deletions
+18
View File
@@ -0,0 +1,18 @@
function createCorrelationId(prefix = "fe"): string {
const randomPart = Math.random().toString(36).slice(2, 10);
return `${prefix}-${Date.now()}-${randomPart}`;
}
export function withCorrelation(init: RequestInit, prefix = "fe"): { correlationId: string; init: RequestInit } {
const correlationId = createCorrelationId(prefix);
const headers = new Headers(init.headers ?? undefined);
headers.set("x-correlation-id", correlationId);
return {
correlationId,
init: {
...init,
headers,
},
};
}