-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Return Response on all Response functions #897
Copy link
Copy link
Closed
Labels
Description
Currently some Response functions return the Response.
These include response.send(), response.json() and some others.
Why do those functions return Response, but others like response.sendFile() and response.render() don't?
Currently I am (ab)using the Response return of response.send() to make sure my routing functions always return a response and don't get stuck in some function paths.
function myRoute(request: Request, response: Response): Promise<Response> {
return response.send('A response!'); // Returns Response
}It would be very useful to me if the rest of the Response functions also return the Response.
Reactions are currently unavailable