eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
747 stars 131 forks source link

mockResponse.end(): added callback triggering once end() logic has run. #248

Closed GiordanoArman closed 2 years ago

GiordanoArman commented 2 years ago

Hi @eugef, thanks for the help. I added support for the various signatures of end() mentioned on the documentation https://nodejs.org/api/http.html#http_response_end_data_encoding_callback

response.end([data[, encoding]][, callback])

I hope my work is neat enough!

GiordanoArman commented 2 years ago

AFAIK this PR still doesn't solve your initial problem #6 (comment)

basically I needed the callback argument to be triggered by the mock response end() method :)

eprev commented 1 year ago

Looks like this wasn't published in the end? 1.11 does not contain these changes.