MCPcopy Create free account
hub / github.com/SplootCode/splootcode / replayFetch

Function replayFetch

packages/runtime-python/src/webworker.ts:89–108  ·  view source on GitHub ↗
(fetchData: {
  method: string
  url: string
  headers: { [key: string]: string }
  body: any
})

Source from the content-addressed store, hash-verified

87}
88
89const replayFetch = (fetchData: {
90 method: string
91 url: string
92 headers: { [key: string]: string }
93 body: any
94}): ResponseData => {
95 const serializedRequest = JSON.stringify(fetchData)
96 if (requestPlayback && requestPlayback.has(serializedRequest)) {
97 const responses = requestPlayback.get(serializedRequest)
98 if (responses.length !== 0) {
99 return responses.shift()
100 }
101 }
102 return {
103 error: {
104 type: FetchSyncErrorType.NO_RECORDED_REQUEST,
105 message: 'Run program to make requests.',
106 },
107 }
108}
109
110const syncFetch = (method: string, url: string, headers: any, body: any): ResponseData => {
111 let objHeaders = {}

Callers 1

syncFetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected