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

feature: support adding queries to RedirectToRoute #1858

Merged
merged 3 commits into from Apr 15, 2022

Conversation

efectn
Copy link
Member

@efectn efectn commented Apr 14, 2022

Closes: #1850
Example:

// /user/fiber?data[0][name]=john&data[0][age]=10&test=doe
c.RedirectToRoute("user", Map{
	"name":    "fiber",
	"queries": map[string]string{"data[0][name]": "john", "data[0][age]": "10", "test": "doe"},
})

Benchmark Results:

Benchmark_Ctx_RedirectToRoute-4   	 3782589	       306.6 ns/op	      16 B/op	       1 allocs/op
Benchmark_Ctx_RedirectToRouteWithQueries-4   	  981728	      1315 ns/op	     376 B/op	       4 allocs/op

I didn't use "url" lib because of it makes extra allocations (+5 allocs). I think this way is faster and more elegant.

@efectn efectn changed the title feature: support adding queries for RedirectToRoute feature: support adding queries to RedirectToRoute Apr 14, 2022
@ReneWerner87 ReneWerner87 merged commit c42af6d into gofiber:master Apr 15, 2022
16 checks passed
trim21 pushed a commit to trim21/fiber that referenced this issue Aug 15, 2022
* Support adding queries for RedirectToRoute method.

* fix security check.

*  feature: support adding queries to RedirectToRoute

Co-authored-by: wernerr <rene@gofiber.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants