feat: add correlation ids and tighten frontend security headers (#299)
* feat: add correlation ids and tighten frontend security headers * docs: remove obsolete project setup guide * fix: restore health config flags for compatibility * test(frontend): align auth fetch assertions with correlation headers
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
function createCorrelationId(prefix = "fe"): string {
|
||||
export function createCorrelationId(prefix: string = "fe"): string {
|
||||
const randomPart = Math.random().toString(36).slice(2, 10);
|
||||
return `${prefix}-${Date.now()}-${randomPart}`;
|
||||
return `${prefix}-${Date.now().toString(36)}-${randomPart}`;
|
||||
}
|
||||
|
||||
export function withCorrelation(init: RequestInit, prefix = "fe"): { correlationId: string; init: RequestInit } {
|
||||
export function withCorrelation(
|
||||
init?: RequestInit,
|
||||
prefix: string = "fe"
|
||||
): { correlationId: string; init: RequestInit } {
|
||||
const correlationId = createCorrelationId(prefix);
|
||||
const headers = new Headers(init.headers ?? undefined);
|
||||
const headers = new Headers(init?.headers ?? {});
|
||||
headers.set("x-correlation-id", correlationId);
|
||||
|
||||
return {
|
||||
correlationId,
|
||||
init: {
|
||||
|
||||
Reference in New Issue
Block a user