export function getBinaryCloudEventContext()

in src/cloud_events.ts [59:72]


export function getBinaryCloudEventContext(
  req: express.Request,
): CloudEvent<unknown> {
  const context = {} as CloudEvent<unknown>;
  for (const name in req.headers) {
    if (name.startsWith('ce-')) {
      const attributeName = name.substr(
        'ce-'.length,
      ) as keyof CloudEvent<unknown>;
      context[attributeName] = req.header(name);
    }
  }
  return context;
}