MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getStringHeaders

Function getStringHeaders

apps/api/src/controllers/track.controller.ts:35–54  ·  view source on GitHub ↗
(headers: FastifyRequest['headers'])

Source from the content-addressed store, hash-verified

33import { getDeviceId } from '@/utils/ids';
34
35export function getStringHeaders(headers: FastifyRequest['headers']) {
36 return Object.entries(
37 pick(
38 [
39 'user-agent',
40 'openpanel-sdk-name',
41 'openpanel-sdk-version',
42 'openpanel-client-id',
43 'request-id',
44 ],
45 headers
46 )
47 ).reduce(
48 (acc, [key, value]) => ({
49 ...acc,
50 [key]: value ? String(value) : undefined,
51 }),
52 {}
53 );
54}
55
56function getIdentity(body: ITrackHandlerPayload): IIdentifyPayload | undefined {
57 if (body.type === 'track') {

Callers 2

postEventFunction · 0.90
buildContextFunction · 0.85

Calls 1

pickFunction · 0.50

Tested by

no test coverage detected