Skip to content

Support for context #65

@Merovius

Description

@Merovius

Many of the fields of server.Server are callbacks that don't take either an *http.Request or a context.Context as arguments. This means it is impossible to use any request-specific information in them: For example, I'd like to log errors with a request ID, increment metrics with request-specific labels (like the path and method) and set a custom verbosity per request.

It would be great if there was a way to set these fields on a per-request basis. The simplest way would be to add a context.Context field, but that would be backwards-incompatible. Another way would be to add a (for example) CallbacksForRequest(*http.Request) Server function that could be used to return closures encapsulating all the request-specific data needed. That would be less ergonomical, but work.

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