eugef / node-mocks-http

Mock 'http' objects for testing Express,js, Next.js and Koa routing functions
Other
761 stars 135 forks source link

sendStatus() does not return response object #144

Closed ghost closed 7 years ago

ghost commented 7 years ago

But just undefined, hence code calling e.g. rsp.sendStatus(...).end() will not work/crash.

howardabrams commented 7 years ago

I believe I'm missing something. What are you expecting this case? Thanks.

ghost commented 7 years ago

The current implementation of sendStatus() returns the response object, so you can use it afterwards, like calling end(). However a) the Express 4 documentation doesn't mention it and b) it doesn't make much sense apparently, because sendStatus() is a final action. So I guess the current mock's fine.