jsUri
jsUri copied to clipboard
"getQueryParamValue" is case sensitive
Could getQueryParamValue ignore case sensitive? So these will return the same result:
uri.getQueryParamValue("productId")
uri.getQueryParamValue("ProductId")
uri.getQueryParamValue("productid")
uri.getQueryParamValue("PRODUCTID")
What sort of environment are you working in that has case-insensitive URL params?
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?
@derek-watson Would you accept pull request for this? I'm thinking adding a boolean argument will make sense.
@alFReD-NSH do you have a fork with the necessary change... I would like to go there.
@derek-watson , I made a pull request #63. I appreciate if you could have a look and tell me what you think.
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
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