Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mux): support http.Request.PathValue in Go 1.22 #901

Merged
merged 1 commit into from
Feb 17, 2024

Conversation

angelofallars
Copy link
Contributor

Resolves #873

Adds support for getting path values with http.Request.PathValue.

In Go versions earlier than 1.22 that don't have that method this shouldn't break them due to conditional compilation.

http.Request.PathValue will act as an alias for chi.URLParam.

The only syntax in common with 1.22 pattern matching seems to be single-segment matches like /b/{bucket}. Other 1.22 features like remaining segment matches (/files/{path...}) and matching trailing slashes (/exact/match/{$}) are not yet supported. Since they are more complicated and overlap with already-existing Chi functionality, they should be addressed in a separate discussion/PR.

@angelofallars angelofallars changed the title feat(mux): Support http.Request.PathValue in Go 1.22 feat(mux): support http.Request.PathValue in Go 1.22 Feb 12, 2024
@pkieltyka pkieltyka merged commit fd0ff0e into go-chi:master Feb 17, 2024
@pkieltyka
Copy link
Member

thanks again @angelofallars :)

@angelofallars
Copy link
Contributor Author

@pkieltyka You're welcome! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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