From a850a6d9ada538bb7864fdb78a995807820c1de2 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Sun, 8 May 2016 11:48:24 -0700 Subject: [PATCH] Make `request.middleware` a public property --- lib/request.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/request.ts b/lib/request.ts index e68f864..635293f 100644 --- a/lib/request.ts +++ b/lib/request.ts @@ -48,6 +48,7 @@ export default class Request extends Base implements Promise { body: any options: any transport: TransportOptions + middleware: Middleware[] = [] opened = false aborted = false @@ -57,7 +58,6 @@ export default class Request extends Base implements Promise { private _downloadedBytes: number = null _raw: any - _use: Middleware[] = [] _progress: ProgressFunction[] = [] private _promise: Promise @@ -81,7 +81,7 @@ export default class Request extends Base implements Promise { // External promise representation, resolves _after_ middleware. this._promise = new Promise((resolve) => { process.nextTick(() => { - const handle = compose(this._use) + const handle = compose(this.middleware) const cb = () => { this._handle() @@ -127,7 +127,7 @@ export default class Request extends Base implements Promise { transport: this.transport, timeout: this.timeout, rawHeaders: this.rawHeaders, - use: this._use, + use: this.middleware, progress: this._progress } } @@ -149,7 +149,7 @@ export default class Request extends Base implements Promise { use (fns: Middleware | Middleware[]) { for (const fn of arrify(fns)) { - this._use.push(fn) + this.middleware.push(fn) } return this