MCPcopy Create free account
hub / github.com/Botloader/botloader / writeBody

Method writeBody

components/runtime/src/ts/httpclient.ts:189–204  ·  view source on GitHub ↗
(body: RequestBody, rid: number)

Source from the content-addressed store, hash-verified

187 }
188
189 private async writeBody(body: RequestBody, rid: number) {
190 let buf = new Uint8Array(1024 * 10);
191 while (true) {
192 let read = await body.read(buf);
193 if (read > 0) {
194 let written = await Deno.core.write(rid, buf.subarray(0, read));
195 if (written < read) {
196 return
197 }
198 }
199
200 if (read === 0) {
201 return
202 }
203 }
204 }
205
206 async sendJson(data: any) {
207 const serialized = encodeText(JSON.stringify(data));

Callers 1

sendMethod · 0.95

Calls 2

readMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected