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

Function makeJsonResponse

apps/sim/tools/index.test.ts:1720–1736  ·  view source on GitHub ↗
(
      status: number,
      body: unknown,
      extraHeaders?: Record<string, string>
    )

Source from the content-addressed store, hash-verified

1718
1719 describe('Tool request retries', () => {
1720 function makeJsonResponse(
1721 status: number,
1722 body: unknown,
1723 extraHeaders?: Record<string, string>
1724 ): any {
1725 const headers = new Headers({ 'content-type': 'application/json', ...(extraHeaders ?? {}) })
1726 return {
1727 ok: status >= 200 && status < 300,
1728 status,
1729 statusText: status >= 200 && status < 300 ? 'OK' : 'Error',
1730 headers,
1731 json: () => Promise.resolve(body),
1732 text: () => Promise.resolve(typeof body === 'string' ? body : JSON.stringify(body)),
1733 arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),
1734 blob: () => Promise.resolve(new Blob()),
1735 }
1736 }
1737
1738 it('retries on 5xx responses for http_request', async () => {
1739 global.fetch = Object.assign(

Callers 1

index.test.tsFile · 0.85

Calls 1

resolveMethod · 0.65

Tested by

no test coverage detected