Skip to content

Commit aa987ae

Browse files
author
myrepo
committed
Fix: JSONResponse helper to preserve original onResponse behavior (Fixes #5042)
1 parent 5535d16 commit aa987ae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/helper/JSONResponse.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ class JSONResponse extends Helper {
7272
if (!this.helpers[this.options.requestHelper]) {
7373
throw new Error(`Error setting JSONResponse, helper ${this.options.requestHelper} is not enabled in config, helpers: ${Object.keys(this.helpers)}`)
7474
}
75-
// connect to REST helper
75+
const origOnResponse = this.helpers[this.options.requestHelper].config.onResponse;
7676
this.helpers[this.options.requestHelper].config.onResponse = response => {
77-
this.response = response
78-
}
77+
this.response = response;
78+
if (typeof origOnResponse === 'function') origOnResponse(response);
79+
};
7980
}
8081

8182
_before() {

0 commit comments

Comments
 (0)