MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / createWebhookFetch

Function createWebhookFetch

server/src/training-agent/webhook-fetch.ts:121–131  ·  view source on GitHub ↗
(options: { allowPrivateIp: boolean })

Source from the content-addressed store, hash-verified

119 * function always dereferences `globalThis.fetch` lazily so tests that replace
120 * the global see their replacement. */
121export function createWebhookFetch(options: { allowPrivateIp: boolean }): typeof fetch {
122 return async (input, init) => {
123 if (!options.allowPrivateIp) {
124 const href = typeof input === 'string' || input instanceof URL
125 ? input.toString()
126 : input.url;
127 await assertPublicTarget(new URL(href));
128 }
129 return globalThis.fetch(input, init);
130 };
131}

Callers 2

getWebhookEmitterFunction · 0.85

Calls 1

assertPublicTargetFunction · 0.85

Tested by

no test coverage detected