Skip to content

Commit

Permalink
Merge pull request #38 from JohnnyEstilles/hotfix/response-statuscode…
Browse files Browse the repository at this point in the history
…-default

Setting mockResponse.statusCode default to 200
  • Loading branch information
howardabrams committed Mar 5, 2015
2 parents e61617d + 91efe55 commit 5619386
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/mockResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function createResponse(options) {

var mockResponse = {};

mockResponse.statusCode = -1;
mockResponse.statusCode = 200;
mockResponse.cookies = {};

mockResponse.cookie = function(name, value, options) {
Expand Down Expand Up @@ -194,11 +194,6 @@ function createResponse(options) {
mockResponse.json = function(a, b) {

mockResponse.setHeader('Content-Type', 'application/json');
// Sets default status code if none has been specify.
if(mockResponse.statusCode === -1) {
mockResponse.statusCode = 200;
}

if (a) {
if (typeof a === 'number') {
mockResponse.statusCode = a;
Expand Down
2 changes: 1 addition & 1 deletion test/test-mockResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports['object - Simple verification'] = function (test) {

exports['object - Data Initialization'] = function (test) {
var response = httpMocks.createResponse();
test.equal(-1, response.statusCode);
test.equal(200, response.statusCode);
test.equal("", response._getData());
test.ok(!response._isUTF8());
test.ok(!response._isEndCalled());
Expand Down

0 comments on commit 5619386

Please sign in to comment.