MCPcopy Index your code
hub / github.com/simstudioai/sim / test

Function test

apps/sim/lib/data-drains/destinations/webhook.ts:157–178  ·  view source on GitHub ↗
({ config, credentials, signal })

Source from the content-addressed store, hash-verified

155 credentialsSchema: webhookCredentialsSchema,
156
157 async test({ config, credentials, signal }) {
158 const resolvedIP = await resolvePublicTarget(config.url)
159 const probe = Buffer.from('{"sim":"connection-test"}\n', 'utf8')
160 const headers = buildHeaders({
161 config,
162 credentials,
163 body: probe,
164 contentType: 'application/x-ndjson',
165 isProbe: true,
166 })
167 const response = await secureFetchWithPinnedIP(config.url, resolvedIP, {
168 method: 'POST',
169 body: new Uint8Array(probe),
170 headers,
171 signal,
172 timeout: PER_ATTEMPT_TIMEOUT_MS,
173 maxResponseBytes: MAX_RESPONSE_BYTES,
174 })
175 if (!response.ok) {
176 throw new Error(`Webhook probe failed: HTTP ${response.status}`)
177 }
178 },
179
180 openSession({ config, credentials }) {
181 let resolvedIP: string | null = null

Callers

nothing calls this directly

Calls 3

secureFetchWithPinnedIPFunction · 0.90
resolvePublicTargetFunction · 0.85
buildHeadersFunction · 0.70

Tested by

no test coverage detected