forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples/mux): support query string in path (gnolang#3281)
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]>
- Loading branch information
1 parent
2135a2b
commit 4425503
Showing
4 changed files
with
93 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters