Closed as not planned
Description
Affects: Spring Boot 2.7.5
Hello,
I recently realised that one of my GET
endpoints has issues if the values passed in the query params contain commas (,
).
Basically, I expect to be able to embed a comma into a single value being passed into a query param, however, the receiving end must define the data type as List<String>
& Spring splits the value into 2 rather than keeping it in one piece.
To give an example, assume you have this endpoint:
@GetMapping
public ResponseEntity<List<String>> getSomeResource(@RequestParam("res") List<String> resources) {
return ResponseEntity.ok(resources);
}
If you hit it with this request:
curl http://localhost:8080/test?res=xx%2Cyy
then you get back ["xx","yy"]
, which is exactly the same result as requesting curl http://localhost:8080/test?res=xx,yy
, but I expect to get back a list with a single element instead, ["xx,yy"]
.
Demo app can be found here.
Thank you very much!