eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
753 stars 133 forks source link

Send request body/payload to trigger relevant events #164

Closed amitguptagwl closed 6 years ago

amitguptagwl commented 6 years ago

162

Following change will trigger 'data', and 'end' event on request stream when user calls 'send' method.

eugef commented 6 years ago

Thanks for the PR, i'll take a look asap

eugef commented 6 years ago

@amitguptagwl 1 test is failing, please fix it

1) mockRequest helper functions .send() should trigger data and end event when nothing is given:
     Error: Unsupported data type to send :undefined
      at Error (native)
      at EventEmitter.mockRequest.send (lib/mockRequest.js:418:19)
      at Context.<anonymous> (test/lib/mockRequest.spec.js:763:17)
eugef commented 6 years ago

@amitguptagwl thanks for the PR