Skip to content

Documentation on Handlers returning Promises #1188

@RatchetS2

Description

@RatchetS2

Many function handlers expect us to return either nothing or a Promise:
(res: HttpResponse, req: HttpRequest) => void | Promise<void>
This applies to various handlers, including HTTP method handlers, App listen/filter, and WebSocket upgrade/open/message/dropped.

Should we return a Promise that resolves once we've responded to the client?
Does it perform any cleanup or optimization with that Promise?
If its just to indicate that we can respond asynchronously, I believe it may be misleading, and we should change the signature to:
(res: HttpResponse, req: HttpRequest) => void

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions