1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(std/http): Don't expose ServerRequest::done as Deferred (#8919)

This commit is contained in:
Nayeem Rahman 2020-12-30 01:22:09 +00:00 committed by GitHub
parent ed0df31e77
commit 268e47c0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,9 +21,14 @@ export class ServerRequest {
conn!: Deno.Conn;
r!: BufReader;
w!: BufWriter;
done: Deferred<Error | undefined> = deferred();
#done: Deferred<Error | undefined> = deferred();
private _contentLength: number | undefined | null = undefined;
get done(): Promise<Error | undefined> {
return this.#done.then((e) => e);
}
/**
* Value of Content-Length header.
* If null, then content length is invalid or not given (e.g. chunked encoding).
@ -93,7 +98,7 @@ export class ServerRequest {
}
// Signal that this request has been processed and the next pipelined
// request on the same connection can be accepted.
this.done.resolve(err);
this.#done.resolve(err);
if (err) {
// Error during responding, rethrow.
throw err;