update onData handle, allow for user data to be attached to response

This commit is contained in:
Kyle McCarthy 2019-03-04 09:29:17 -06:00
parent c1fef4ed20
commit 5b97a8f59d

5
docs/index.d.ts vendored
View File

@ -67,10 +67,13 @@ interface HttpResponse {
onAborted(handler: (res: HttpResponse) => void) : HttpResponse; onAborted(handler: (res: HttpResponse) => void) : HttpResponse;
/** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/ /** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/
onData(handler: (res: HttpResponse, chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse; onData(handler: (chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse;
/** Returns the remote IP address */ /** Returns the remote IP address */
getRemoteAddress() : ArrayBuffer; getRemoteAddress() : ArrayBuffer;
/** Arbitrary user data may be attached to this object */
[key: string]: any;
} }
/** An HttpRequest is stack allocated and only accessible during the callback invocation. */ /** An HttpRequest is stack allocated and only accessible during the callback invocation. */