MCPcopy Create free account
hub / github.com/dailydotdev/apps / addGenerationIdHeader

Function addGenerationIdHeader

packages/shared/src/lib/ads.ts:160–181  ·  view source on GitHub ↗
({
  ad,
  res,
}: {
  ad: Ad | null;
  res: Response;
})

Source from the content-addressed store, hash-verified

158const skadiGenerationIdHeader = 'x-generation-id';
159
160const addGenerationIdHeader = ({
161 ad,
162 res,
163}: {
164 ad: Ad | null;
165 res: Response;
166}): Ad | null => {
167 if (!ad) {
168 return ad;
169 }
170
171 const generationId = res.headers.get(skadiGenerationIdHeader);
172
173 if (!generationId) {
174 return ad;
175 }
176
177 return {
178 ...ad,
179 generationId,
180 };
181};
182
183const fetchAdRequest = async ({
184 path,

Callers 1

fetchAdRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected