MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / readRequestBody

Function readRequestBody

scripts/http-body.mjs:16–35  ·  view source on GitHub ↗
(req, limit)

Source from the content-addressed store, hash-verified

14 * @returns {Promise<Buffer>}
15 */
16export function readRequestBody(req, limit) {
17 return new Promise((resolve, reject) => {
18 const chunks = [];
19 let size = 0;
20 req.on("data", (chunk) => {
21 size += chunk.length;
22 if (size > limit) {
23 reject(new Error("request body too large"));
24 req.destroy();
25 return;
26 }
27 chunks.push(chunk);
28 });
29 req.on("end", () => resolve(Buffer.concat(chunks)));
30 req.on("error", reject);
31 req.on("close", () => {
32 if (!req.complete) reject(new Error("request aborted"));
33 });
34 });
35}

Callers 2

signInWithDigitalOceanFunction · 0.90
readJsonBodyFunction · 0.90

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected