From b86e6f91e006570aca9e380c08d93a34cb4e66f6 Mon Sep 17 00:00:00 2001 From: Tim Scanlin Date: Wed, 8 Feb 2017 13:54:23 -0800 Subject: [PATCH 1/2] add variable so that afterware can have mutations --- src/transport/networkInterface.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/transport/networkInterface.ts b/src/transport/networkInterface.ts index 8dda7f5f478..216d73f299f 100644 --- a/src/transport/networkInterface.ts +++ b/src/transport/networkInterface.ts @@ -135,16 +135,15 @@ export class HTTPFetchNetworkInterface implements NetworkInterface { options, }: ResponseAndOptions): Promise { return new Promise((resolve, reject) => { + // Declare responseObject so that afterware can mutate it. + const responseObject = { response, options } const queue = (funcs: any[], scope: any) => { const next = () => { if (funcs.length > 0) { const f = funcs.shift(); - f.applyAfterware.apply(scope, [{ response, options }, next]); + f.applyAfterware.apply(scope, [responseObject, next]); } else { - resolve({ - response, - options, - }); + resolve(responseObject); } }; next(); From 5e8d939cf4067dc1d55421cbd2318ad7cffab278 Mon Sep 17 00:00:00 2001 From: Tim Scanlin Date: Wed, 8 Feb 2017 14:51:35 -0800 Subject: [PATCH 2/2] add missing semicolon --- src/transport/networkInterface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transport/networkInterface.ts b/src/transport/networkInterface.ts index 216d73f299f..ee603f5061a 100644 --- a/src/transport/networkInterface.ts +++ b/src/transport/networkInterface.ts @@ -136,7 +136,7 @@ export class HTTPFetchNetworkInterface implements NetworkInterface { }: ResponseAndOptions): Promise { return new Promise((resolve, reject) => { // Declare responseObject so that afterware can mutate it. - const responseObject = { response, options } + const responseObject = { response, options }; const queue = (funcs: any[], scope: any) => { const next = () => { if (funcs.length > 0) {