Skip to content

Commit

Permalink
setHeader should return this (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal committed Mar 13, 2023
1 parent ee5fdab commit 7665e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mockResponse.js
Expand Up @@ -638,7 +638,7 @@ function createResponse(options) {
*/
mockResponse.setHeader = function(name, value) {
mockResponse._headers[name.toLowerCase()] = value;
return value;
return this;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions test/lib/mockResponse.spec.js
Expand Up @@ -967,6 +967,10 @@ describe('mockResponse', function () {
expect(response.setHeader).to.throw;
});

it('should return this', function() {
expect(response.setHeader('name', 'value')).to.be(response);
})

});

describe('.getHeader()', function () {
Expand Down

0 comments on commit 7665e06

Please sign in to comment.