Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

"getQueryParamValue" is case sensitive #57

Open
tung-dang opened this issue Dec 3, 2015 · 7 comments
Open

"getQueryParamValue" is case sensitive #57

tung-dang opened this issue Dec 3, 2015 · 7 comments

Comments

@tung-dang
Copy link

Could getQueryParamValue ignore case sensitive? So these will return the same result:

uri.getQueryParamValue("productId")
uri.getQueryParamValue("ProductId")
uri.getQueryParamValue("productid")
uri.getQueryParamValue("PRODUCTID")
@derek-watson
Copy link
Owner

What sort of environment are you working in that has case-insensitive URL params?

@PandaWood
Copy link

PandaWood commented Oct 12, 2016

This is an issue for me as well...

I have code like this, looking for 'iscloud' querystring: uri.getQueryParamValue('iscloud')
Because I know admins using my site will type in something like this: blaurldemo?isCloud=true

Now users of my website have to get the casing right or my code doesn't find the param.

Right now, it's a bug and I have to tell these particular users to use lower case please.
I think case sensitivity is wrong and unnecessary in a query string library, when searching for parameters, do you agree?

@faridnsh
Copy link

faridnsh commented Feb 5, 2017

@derek-watson Would you accept pull request for this? I'm thinking adding a boolean argument will make sense.

@PandaWood
Copy link

@alFReD-NSH do you have a fork with the necessary change... I would like to go there.

@faridnsh
Copy link

faridnsh commented Feb 7, 2017

@derek-watson , I made a pull request #63. I appreciate if you could have a look and tell me what you think.

@PandaWood
Copy link

PandaWood commented May 11, 2017

And this is my pull request #64 - sorry to compete with #63 but I have a few less calls to toLowerCase() as I store the lower case instance of the string and then the == comparison works without calling it explicitly every time

@PandaWood
Copy link

PandaWood commented Apr 4, 2019

Please ignore my PR #64 - it has a bug in itself. I was over zealous in applying toLowerCase and the results returned are actually converted to all lower case as a result - which is not desirable either.
I should add some unit tests to cover it and fix it but #63 looks like a good alternative

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants