diff --git a/index.js b/index.js index 57682de..dff1dd0 100644 --- a/index.js +++ b/index.js @@ -96,11 +96,7 @@ function mock(superagent) { setTimeout(function(request) { try { var response = current(request); - if (response.status !== 200) { - cb && cb(response, null); - } else { - cb && cb(null, response); - } + cb && cb(null, response); } catch (ex) { cb && cb(ex, null); } @@ -223,15 +219,12 @@ Route.prototype.match = function(method, url, body) { } var route = this; return function(req) { - var handlerValue = route.handler({ + return route.handler({ url: url, params: params || {}, body: mergeObjects(body, req.body), headers: req.headers }); - return mergeObjects({ - status: 200 - }, handlerValue); }; }; diff --git a/test.js b/test.js index 7dd6de7..76b39d5 100644 --- a/test.js +++ b/test.js @@ -183,17 +183,6 @@ describe('superagent mock', function() { }); }); - it('should support status code in response', function(done) { - mock.get('/topics/:id', function(req) { - return {body: {}, status: 500}; - }); - request.get('/topics/1') - .end(function(err, data) { - err.should.have.property('status', 500); - done(); - }); - }); - it('should support headers', function(done) { mock.get('/topics/:id', function(req) { return req.headers;