@@ -170,9 +170,6 @@ export interface HttpResponse {
170170 /** Returns the global byte write offset for this response. Use with onWritable. */
171171 getWriteOffset ( ) : number ;
172172
173- /** Returns the max remaining body length of the currently read HTTP body. */
174- maxRemainingBodyLength ( ) : bigint ;
175-
176173 /** Registers a handler for writable events. Continue failed write attempts in here.
177174 * You MUST return true for success, false for failure.
178175 * Writing nothing is always success, so by default you must return true.
@@ -189,21 +186,25 @@ export interface HttpResponse {
189186 * Must be attached before performing any asynchronous operation, otherwise data may be lost.
190187 * You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making them zero length. */
191188 onData ( handler : ( chunk : ArrayBuffer , isLast : boolean ) => void ) : HttpResponse ;
189+
192190 /** Pause HTTP request body streaming (throttle).
193191 * Some buffered data may still be sent to onData. */
194192 pause ( ) : void ;
193+
195194 /** Resume HTTP request body streaming (unthrottle). */
196195 resume ( ) : void ;
197196
198197 /** Accumulates all data chunks and calls handler with the complete body as an ArrayBuffer once all data has arrived.
199198 * If the total body size exceeds maxSize bytes, handler is called with null instead. */
200- onFullData ( maxSize : number , handler : ( fullBody : ArrayBuffer | null ) => void ) : HttpResponse ;
199+ collectBody ( maxSize : number , handler : ( fullBody : ArrayBuffer | null ) => void ) : HttpResponse ;
201200
202- /** Combined handler for HTTP request body streaming and connection abort events.
203- * If chunk is null, the connection was aborted. If maxRemainingBodyLength is 0n, the last chunk has arrived.
204- * You can safely preallocate using maxRemainingBodyLength (it is very large for chunked transfer encoding).
205- * You MUST copy the data of chunk if maxRemainingBodyLength is not 0n. We Neuter ArrayBuffers on return, making them zero length. */
206- onStream ( handler : ( chunk : ArrayBuffer | null , maxRemainingBodyLength : bigint ) => void ) : HttpResponse ;
201+ /** Handler for reading HTTP request body data. V2.
202+ * Must be attached before performing any asynchronous operation, otherwise data may be lost.
203+ * You MUST copy the data of chunk if maxRemainingBodyLength is not 0. We Neuter ArrayBuffers on return, making them zero length.
204+ *
205+ * maxRemainingBodyLength is the known maximum of the remaining body length. Can be used to preallocate a receive buffer.
206+ */
207+ onDataV2 ( handler : ( chunk : ArrayBuffer | null , maxRemainingBodyLength : bigint ) => void ) : HttpResponse ;
207208
208209 /** Returns the remote IP address in binary format (4 or 16 bytes). */
209210 getRemoteAddress ( ) : ArrayBuffer ;
0 commit comments