eclipse-vertx / eclipse-vertx/vert.x
queryString key should be case sensitive
- Dominant language
- Java
- Stars
- 14.7k
- Forks
- 2.1k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 27
Description
given url `/test?key=v1&Key=v2&KEY=v3` it should return different value as below, but now it all returns *v3*
```
rc.request.getParam("key") //should return v1
rc.request.getParam("Key") //should return v2
rc.request.getParam("KEY") //should return v3
```
> 6.2.2.1. Case Normalization
>
> When a URI uses components of the generic syntax, the component syntax equivalence rules always apply; namely, that the scheme and host are case-insensitive and therefore should be normalized to lowercase. For example, the URI is equivalent to http://www.example.com/.
>
> The other generic syntax components are assumed to be case-sensitive unless specifically defined otherwise by the scheme (see Section 6.2.3).
The code causing issue is `HttpUtils.params` , it should not use CaseInsensitiveHeaders
```
static MultiMap params(String uri) {
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri);
Map> prms = queryStringDecoder.parameters();
MultiMap params = new CaseInsensitiveHeaders();
if (!prms.isEmpty()) {
for (Map.Entry> entry: prms.entrySet()) {
params.add(entry.getKey(), entry.getValue());
}
}
return params;
}
```
Contributor guide
Assessment
This issue has not been assessed yet.