Permalink
Browse files

Move 'response' callback back to the end of the function. It really s…

…hould be the last thing done. The 'check' at the beginning is still the right thing to do though.
  • Loading branch information...
1 parent e8505bf commit e6a9d0fb5e09d99c71202b9aee7d50945d156e19 @mjumbewu committed May 18, 2011
Showing with 3 additions and 16 deletions.
  1. +3 −16 bin/expresso
View
@@ -436,22 +436,6 @@ assert.response = function(server, req, res, msg){
// Shut down the server
check();
- /**
- * I feel like this is almost right. Instead, I think all these
- * asserts should be wrapped in a try/catch block and that there
- * should be an error callback that is passed in as a parameter.
- * If an error is caught, it should be passed along to the error
- * callback along with the response. Otherwise the normal
- * callback should be called.
- *
- * For now, since I don't want to go through the logic of
- * checking for an error callback (and should it come before or
- * after the normal one), I'm going to leave this.
- */
-
- // Callback
- callback(response);
-
// Assert response body
if (res.body !== undefined) {
var eql = res.body instanceof RegExp
@@ -494,6 +478,9 @@ assert.response = function(server, req, res, msg){
);
}
}
+
+ // Callback
+ callback(response);
});
});
request.end();

0 comments on commit e6a9d0f

Please sign in to comment.