From 53d16c30a9dc0f9ec5fe6bc6522b313ad81a7b07 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:16:54 +0000 Subject: [PATCH 1/2] Initial plan From a64298ad128a734cf1dc5a2d669ff204aa979306 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:19:49 +0000 Subject: [PATCH 2/2] Rename onFullData to accumulateBody Co-authored-by: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> --- docs/index.d.ts | 2 +- src/HttpResponseWrapper.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.d.ts b/docs/index.d.ts index 29da76ab2..7c454cdf6 100644 --- a/docs/index.d.ts +++ b/docs/index.d.ts @@ -197,7 +197,7 @@ export interface HttpResponse { /** Accumulates all data chunks and calls handler with the complete body as an ArrayBuffer once all data has arrived. * If the total body size exceeds maxSize bytes, handler is called with null instead. */ - onFullData(maxSize: number, handler: (fullBody: ArrayBuffer | null) => void) : HttpResponse; + accumulateBody(maxSize: number, handler: (fullBody: ArrayBuffer | null) => void) : HttpResponse; /** Returns the remote IP address in binary format (4 or 16 bytes). */ getRemoteAddress() : ArrayBuffer; diff --git a/src/HttpResponseWrapper.h b/src/HttpResponseWrapper.h index d69e8e751..8916b1c56 100644 --- a/src/HttpResponseWrapper.h +++ b/src/HttpResponseWrapper.h @@ -111,14 +111,14 @@ struct HttpResponseWrapper { } } - /* Takes integer maxSize and function of fullData. Accumulates all data chunks and calls handler with the complete + /* Takes integer maxSize and a handler function. Accumulates all data chunks and calls handler with the complete * body as an ArrayBuffer once all data has arrived. If the body exceeds maxSize bytes, handler is called with * null instead. Fast path: if all data arrives in a single chunk no allocation is made and the ArrayBuffer is * zero-copy (backed directly by the incoming data, detached after the call). Slow path: chunks are lazily * accumulated into a std::vector whose memory is transferred zero-copy into the ArrayBuffer backing store. * Returns this */ template - static void res_onFullData(const FunctionCallbackInfo &args) { + static void res_accumulateBody(const FunctionCallbackInfo &args) { Isolate *isolate = args.GetIsolate(); auto *res = getHttpResponse(args); if (res) { @@ -587,7 +587,7 @@ struct HttpResponseWrapper { /* QUIC has a lot of functions unimplemented */ if constexpr (SSL != 2) { - resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "onFullData", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_onFullData)); + resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "accumulateBody", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_accumulateBody)); resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "getWriteOffset", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_getWriteOffset)); resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "maxRemainingBodyLength", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_maxRemainingBodyLength)); resTemplateLocal->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "getRemoteAddress", NewStringType::kNormal).ToLocalChecked(), FunctionTemplate::New(isolate, res_getRemoteAddress));