Skip to content

Feature: on Go 1.22, fill (*http.Request).PathValue with URLParam data #873

Description

@AlexVasiluta

Hey y'all!
For Go 1.22, this enhanced ServeMux routing proposal was accepted and pushed into the main tree, and *http.Request has some new methods, SetPathValue and PathValue. I think r.PathValue(...) could act as an alias for chi.URLParam(r, ...) when routing with chi.

There would probably need to be some logic with //go:build go1.22 that runs SetPathValue when inserting keys/values into chi.Context.URLParams for the corresponding http.Request. I have not dug deeper into chi's source code, but I think this would be a welcome addition for when Go 1.22 is released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions