MCPcopy Index your code
hub / github.com/StarpTech/FastGraph / WorktopResponse

Function WorktopResponse

src/test-utils.ts:99–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99export const WorktopResponse = () => {
100 let headers = Headers(null)
101 let body: any,
102 finished = false,
103 statusCode = 0
104 // @ts-ignore
105 return {
106 get headers() {
107 return headers
108 },
109 finished,
110 get statusCode() {
111 return statusCode
112 },
113 setHeader: headers.set,
114 get body() {
115 return JSON.stringify(body)
116 },
117 send: (code, payload, h?: { [s: string]: string }) => {
118 statusCode = code
119 body = payload
120 if (h) {
121 headers = new globalThis.Headers(Object.entries(h))
122 }
123 },
124 end(val: any) {
125 finished = true
126 body = val
127 },
128 } as ServerResponse
129}
130
131export const WorktopRequest = (
132 method = 'POST',

Callers 2

apq.test.tsFile · 0.90
graphql.test.tsFile · 0.90

Calls 1

HeadersFunction · 0.70

Tested by

no test coverage detected