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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃 Case sensitivity for parameters in GetRouteURL #1907
Comments
Thanks for opening your first issue here! 馃帀 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
code is developed by sujit-baniya -> #1831 |
@martinwang2002 Thank you for raising the issue. I checked with Case 1: Case 2: I was not able to replicate the issue as mentioned. the fiber version used: 2.33.0 Here's the video of testing. Please let me know if I missed anything in the test |
I agree with you. Could you also please check this part?
with url: http://127.0.0.1:3001/first/second/other_paths In this part of code, you will find that That's why I have this confustion. We can get parameters with case sensitivity, but we cannot set proper keys via GetRouteURL with |
@martinwang2002 I got it now. The issue seems to be coming from route parser. @ReneWerner87 Can we do anything for it? &{/ false 0 false false false false 1}
&{ true testid / 2 false false false false 0}
&{/ false 0 false false false false 1}
&{ true testid /other_paths 1 false false false false 0}
&{/other_paths false 0 false false true false 12} |
if CaseSensitive is set to false, the route is reduced to lower case and the parameters are also attached to the segments of the route in lowercase(in the registration process), since this does not matter according to the setting. Lines 236 to 251 in aa22928
Lines 178 to 188 in aa22928
the request url is also reduced to lowercase for recognition when the setting is enabled Lines 1548 to 1555 in aa22928
possible solution: Line 8 in aa22928
places: Line 835 in aa22928
Line 1149 in aa22928
|
But please still take a look at the performance after these changes i expect only a slight increase if the value could not be found by the first check Line 65 in aa22928
or maybe a check with equalFolds, as this is even faster than converting to lowercase ToLower -> 50ns |
Question description
When using capitalized letters in
fiber.Map{}
withGetRouteURL
, the case sensitivity of the keys is ignored.Code snippet
For example, GET
/
, you will receive/ABC/ABC/other_paths
. The case sensitivity for GetRouteURL is ignoredOn the other hand, c.Params can tell the difference between
testid
andtestId
.I think that
Params
andGetRouteURL
should behave the same behavior on case sensitivity.Meanwhile, enabling
CaseSensitive
in the config will receive/ABC/DEF/other_paths
The text was updated successfully, but these errors were encountered: