-
Notifications
You must be signed in to change notification settings - Fork 389
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 query string in path #3281
feat(mux): support query string in path #3281
Conversation
9122063
to
5c3ee8a
Compare
I'm a bot that assists the Gno Core team in maintaining this repository. My role is to ensure that contributors understand and follow our guidelines, helping to streamline the development process. The following requirements must be fulfilled before a pull request can be merged. These requirements are defined in this configuration file. Automated Checks🔴 Maintainers must be able to edit this pull request (more info) Manual Checks
Debug
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
5c3ee8a
to
3d8b706
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I still consider that we should rename p/mux
into p/router
; what do you think?
Edit: Never mind, I remember that I chose mux
because it mimics the http.Mux
object with the ResponseWriter
. Let's keep it named mux
for now, and we can eventually extract the router
part into a minimal router
package if you're only interested in pure parsing. This can be done later.
fcfa91c
to
136df2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we will get some weird edge cases that fail; but this is an upgrade that is needed for multiple packages, so let's fix along the way.
related #2876 |
This PR adds support for request URLs with query strings for `p/demo/mux` package. Previously, `mux.Router` would fail to find a correct handler if request URL contains query string. ```go r := mux.NewRouter() r.HandleFunc("hello", func (rw *mux.ResponseWriter, req *mux.Request) { ... }) reqUrl := "hello?foo=bar" r.Render(reqUrl) // Fails ``` This PR fixes this behavior and introduces a new `mux.Request.RawPath` field which contains a raw request path including query string. The `RawPath` field is designed to be used for packages like `p/demo/avl/pager` to extract query params from a string.\ The `Path` field, as before, contains just path segment of request, without query strings. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests </details> CC @moul @thehowl @jeronimoalbi --------- Co-authored-by: Leon Hudak <[email protected]> Co-authored-by: Morgan <[email protected]>
This PR adds support for request URLs with query strings for `p/demo/mux` package. Previously, `mux.Router` would fail to find a correct handler if request URL contains query string. ```go r := mux.NewRouter() r.HandleFunc("hello", func (rw *mux.ResponseWriter, req *mux.Request) { ... }) reqUrl := "hello?foo=bar" r.Render(reqUrl) // Fails ``` This PR fixes this behavior and introduces a new `mux.Request.RawPath` field which contains a raw request path including query string. The `RawPath` field is designed to be used for packages like `p/demo/avl/pager` to extract query params from a string.\ The `Path` field, as before, contains just path segment of request, without query strings. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests </details> CC @moul @thehowl @jeronimoalbi --------- Co-authored-by: Leon Hudak <[email protected]> Co-authored-by: Morgan <[email protected]>
This PR adds support for request URLs with query strings for `p/demo/mux` package. Previously, `mux.Router` would fail to find a correct handler if request URL contains query string. ```go r := mux.NewRouter() r.HandleFunc("hello", func (rw *mux.ResponseWriter, req *mux.Request) { ... }) reqUrl := "hello?foo=bar" r.Render(reqUrl) // Fails ``` This PR fixes this behavior and introduces a new `mux.Request.RawPath` field which contains a raw request path including query string. The `RawPath` field is designed to be used for packages like `p/demo/avl/pager` to extract query params from a string.\ The `Path` field, as before, contains just path segment of request, without query strings. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests </details> CC @moul @thehowl @jeronimoalbi --------- Co-authored-by: Leon Hudak <[email protected]> Co-authored-by: Morgan <[email protected]>
This PR adds support for request URLs with query strings for `p/demo/mux` package. Previously, `mux.Router` would fail to find a correct handler if request URL contains query string. ```go r := mux.NewRouter() r.HandleFunc("hello", func (rw *mux.ResponseWriter, req *mux.Request) { ... }) reqUrl := "hello?foo=bar" r.Render(reqUrl) // Fails ``` This PR fixes this behavior and introduces a new `mux.Request.RawPath` field which contains a raw request path including query string. The `RawPath` field is designed to be used for packages like `p/demo/avl/pager` to extract query params from a string.\ The `Path` field, as before, contains just path segment of request, without query strings. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests </details> CC @moul @thehowl @jeronimoalbi --------- Co-authored-by: Leon Hudak <[email protected]> Co-authored-by: Morgan <[email protected]>
This PR adds support for request URLs with query strings for
p/demo/mux
package.Previously,
mux.Router
would fail to find a correct handler if request URL contains query string.This PR fixes this behavior and introduces a new
mux.Request.RawPath
field which contains a raw request path including query string.The
RawPath
field is designed to be used for packages likep/demo/avl/pager
to extract query params from a string.The
Path
field, as before, contains just path segment of request, without query strings.Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the descriptionCC @moul @thehowl @jeronimoalbi