Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
fix: move channels event before user-facing hooks
  • Loading branch information
YoannMa committed Mar 15, 2023
commit 5eb9907495ada104ef7bd691c1d0407e573bc7ec
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ exports = module.exports = internals.Request = class {

this.info.completed = Date.now();

this._core.events.emit('response', this);

Channels.response.publish(this.response);

this._core.events.emit('response', this);

if (this._route._extensions.onPostResponse.nodes) {
this._invoke(this._route._extensions.onPostResponse, { ignoreResponse: true });
}
Expand Down
4 changes: 2 additions & 2 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ internals.Server = class {
route.params = record.params;
}

this.events.emit('route', route.public);

Channels.route.publish(route.public);

this.events.emit('route', route.public);

Cors.options(route.public, server);
}

Expand Down