Skip to content

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

Closed
@AlexVasiluta

Description

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.

Activity

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

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