mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
11 lines
350 B
TypeScript
11 lines
350 B
TypeScript
import type { ServerResponse } from 'http';
|
|
|
|
export function appendValue(res: ServerResponse | undefined, name: string, value: number) {
|
|
const currentValue = res?.getHeader('Server-Timing') || '';
|
|
const nextValue = [
|
|
currentValue,
|
|
`${ name };dur=${ value }`,
|
|
].filter(Boolean).join(',');
|
|
res?.setHeader('Server-Timing', nextValue);
|
|
}
|