Skip to content

Commit

Permalink
user super and arrow fn
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmywarting committed Jan 4, 2022
1 parent 17cf193 commit d2d9616
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,16 @@ class Test extends Request {
* @api public
*/
end(fn) {
const self = this;
const server = this._server;
const end = Request.prototype.end;

end.call(this, function (err, res) {
super.end((err, res) => {
const localAssert = () => {
this.assert(err, res, fn);
};

if (server && server._handle) return server.close(localAssert);

localAssert();

function localAssert() {
self.assert(err, res, fn);
}
});

return this;
Expand Down

0 comments on commit d2d9616

Please sign in to comment.