Skip to content

stdhttp: Receive a mux as interface instead of *http.ServeMux #1718

Closed

Description

@sonalys

I'm currently implementing open-telemetry, and I want to have the route pattern as part of the operation name.
I would be able to get the method and route pattern by injecting a custom ServeMux during the handler initialization.

Following the open-closed principle, you should accept interfaces and return structs. Would it be possible to accept a mux interface instead of the *http.ServeMux struct?

I volunteer myself for implementing it if approved.

Activity

  1. jamietanna commented on Aug 9, 2024

    @jamietanna
    Member

    Would we see this as a breaking change? If so, it's something we can control via a flag.

    It sounds reasonable though!

  2. sonalys commented on Aug 9, 2024

    @sonalys
    ContributorAuthor

    It's not a breaking change. You would simply replace the struct with the expectations of what the struct should implement

  3. jamietanna commented on Aug 9, 2024

    @jamietanna
    Member

    Cool! Yeah we're happy to accept a PR for IT, hopefully can squeeze into the next release (ETA unknown)

  4. sonalys commented on Aug 9, 2024

    @sonalys
    ContributorAuthor

    @jamietanna I opened a Pull Request at #1720

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions