mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
* feat(cli): support extra headers for hub requests * fix(types): normalize missing session fields to null * refactor(cli): simplify socket extra headers config
21 lines
500 B
TypeScript
21 lines
500 B
TypeScript
import { configuration } from '@/configuration'
|
|
|
|
export function buildHubRequestHeaders(baseHeaders: Record<string, string>): Record<string, string> {
|
|
return {
|
|
...configuration.extraHeaders,
|
|
...baseHeaders
|
|
}
|
|
}
|
|
|
|
export function buildSocketIoExtraHeaderOptions(): {
|
|
extraHeaders?: Record<string, string>
|
|
} {
|
|
if (Object.keys(configuration.extraHeaders).length === 0) {
|
|
return {}
|
|
}
|
|
|
|
return {
|
|
extraHeaders: { ...configuration.extraHeaders }
|
|
}
|
|
}
|