mock-req icon indicating copy to clipboard operation
mock-req copied to clipboard

Mocking of header method

Open hellboy81 opened this issue 10 years ago • 1 comments

I'm trying to use ``mock-req`

Initialization in Unit tests:

MockReq = require('mock-req'),
var req = new MockReq();
// req.header = function(){} // with this line it does not work also

Testable code:

if (req.header('content-range')) {

I'm getting message:

TypeError: Object #<MockIncomingMessage> has no method 'header'

hellboy81 avatar Feb 09 '15 11:02 hellboy81

According to http://nodejs.org/api/http.html#http_http_incomingmessage there is no method 'header'.

diachedelic avatar Feb 11 '15 03:02 diachedelic