Skip to content

Return Response on all Response functions #897

@Ionaru

Description

@Ionaru

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions