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

Function buildRequestBody

apps/sim/lib/data-drains/destinations/datadog.ts:134–149  ·  view source on GitHub ↗
(payload: string, apiKey: string)

Source from the content-addressed store, hash-verified

132}
133
134function buildRequestBody(payload: string, apiKey: string): PreparedBody {
135 const headers: Record<string, string> = {
136 'Content-Type': 'application/json',
137 'DD-API-KEY': apiKey,
138 Accept: 'application/json',
139 'User-Agent': 'sim-data-drain/1.0',
140 }
141 const rawBytes = Buffer.byteLength(payload, 'utf8')
142 if (rawBytes > GZIP_THRESHOLD_BYTES) {
143 const compressed = gzipSync(payload)
144 headers['Content-Encoding'] = 'gzip'
145 const view = new Uint8Array(compressed.buffer, compressed.byteOffset, compressed.byteLength)
146 return { body: view, headers, wireBytes: view.byteLength, rawBytes }
147 }
148 return { body: payload, headers, wireBytes: rawBytes, rawBytes }
149}
150
151async function postWithRetries(input: PostInput): Promise<Response> {
152 const { body, headers } = input.prepared

Callers 2

testFunction · 0.70
deliverFunction · 0.70

Calls

no outgoing calls

Tested by 1

testFunction · 0.56