diachedelic / mock-req

Mocks the http.IncomingMessage (request) for Node.js
MIT License
32 stars 3 forks source link

Mocking of header method #1

Open hellboy81 opened 9 years ago

hellboy81 commented 9 years ago

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'
diachedelic commented 9 years ago

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