Permalink
Browse files

Server request event should probably be emitted much earlier

  • Loading branch information...
1 parent 36a7f0a commit bdebf0fa18523a65a53fac59f9a95ae38d3f250f @tedeh committed Sep 21, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/server.js
View
4 lib/server.js
@@ -173,6 +173,8 @@ Server.prototype.error = function(code, message, data) {
Server.prototype.call = function(request, originalCallback) {
var self = this;
+ this.emit('request', request);
+
if(typeof(originalCallback) !== 'function') originalCallback = function() {};
// compose the callback so that we may emit an event on every response
@@ -206,8 +208,6 @@ Server.prototype.call = function(request, originalCallback) {
return callback(utils.response(this.error(Server.errors.INVALID_REQUEST)));
}
- this.emit('request', request);
-
// from now on we are "notification"-aware and can deliberately ignore errors for such requests
var respond = function(error, result) {
if(isNotification(request)) return callback();

0 comments on commit bdebf0f

Please sign in to comment.