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(package): /p/demo/mux support query strings #2594

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

thinhnx-var
Copy link
Contributor

@thinhnx-var thinhnx-var commented Jul 16, 2024

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

This PR aims to support mux package for querying with strings. (relates #2585 )

Usage:

request.Query(): Get  map of keys and list of values from params
request.Query()["key"]: Get list of values corresponding to the key
request.Query().Get("key"): Get the very first value of the key.

@thinhnx-var thinhnx-var requested review from a team as code owners July 16, 2024 06:20
@thinhnx-var thinhnx-var requested review from ajnavarro and petar-dambovaliev and removed request for a team July 16, 2024 06:20
@thinhnx-var thinhnx-var changed the title feat(package) /p/demo/mux support query strings feat(package): /p/demo/mux support query strings Jul 16, 2024
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

grepsuzette

This comment was marked as off-topic.

@thinhnx-var
Copy link
Contributor Author

I am thinking about if we want to use avl tree to store the params instead of using map

@ajnavarro
Copy link
Contributor

@moul @zivkovicmilos can you have a look into this? Thanks.

*/
func (r *Request) Query() UrlQuery {
urlQueries := UrlQuery{}
reqParts := strings.Split(r.Path, "/")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that you're not supporting having a slash in one of the query parameters:

gno.land/p/demo/foo?a=b&c=d/e

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I saw your TODO in current request parser. I will try to update for this /a/b/c/d/... case.

Copy link
Member

@moul moul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're just adding new helpers, but the underlying existing library won't work with the changes, please add more unit tests for the existing helpers with query strings.

like hello/{name} with hello/Alice?a=b -> currently name equals Alice?a=b instead of Alice.

@thinhnx-var
Copy link
Contributor Author

thinhnx-var commented Jul 22, 2024

you're just adding new helpers, but the underlying existing library won't work with the changes, please add more unit tests for the existing helpers with query strings.

like hello/{name} with hello/Alice?a=b -> currently name equals Alice?a=b instead of Alice.

@moul
I have just updated the PR. I am not sure but I think these changes are now working with underlying existing library ( tests are added in Render() test. Can you give a look on this PR when you have a chance?

@thinhnx-var thinhnx-var force-pushed the dev-thinhnx/feat_mux_support_query_strings branch from 8d78ad4 to 48a0eaa Compare September 11, 2024 08:19
@Kouteki Kouteki added review/triage-pending PRs opened by external contributors that are waiting for the 1st review and removed review/triage-pending PRs opened by external contributors that are waiting for the 1st review labels Oct 3, 2024
@leohhhn
Copy link
Contributor

leohhhn commented Nov 26, 2024

@thinhnx-var

What is the state of this PR?

@thinhnx-var
Copy link
Contributor Author

@leohhhn
I did not see any reviews from my last commit and fixes. Let me try updating latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: In Progress
Status: In Review
Development

Successfully merging this pull request may close these issues.

7 participants