Closed
Description
Ayush Kumar opened SPR-15676 and commented
When using List<String> as the request parameter, both key=val1,val2 and key=val1&key=val2 end up mapping to key = [val1, val2]
When using Optional<List<String>> as the request parameter
key=val1,val2 maps to key = Optional([val1,val2])
but key=val1&key=val2 maps to Optional([val1])
This makes RequestParam(..., required = false) List<String> behave differently from RequestParam(...) Optional<List<String>>, which seems unfortunate.
Affects: 4.3.4
Issue Links:
- @RequestParam Optional<List<?>> not handling multiple params of the same name correctly [SPR-15857] #20412
@RequestParam
Optional<List<?>> not handling multiple params of the same name correctly ("is duplicated by") - Request parameters cannot bind to Optional<List<String>> [SPR-13418] #17997 Request parameters cannot bind to Optional<List>
- java.util.Optional MultipartFile[] @RequestParam argument is null in multipart/form-data POST [SPR-15918] #20472 java.util.Optional MultipartFile[]
@RequestParam
argument is null in multipart/form-data POST - only one MultipartFile object populated when using an java.util.Optional MutipartFile array or list @RequestParam [SPR-15919] #20473 only one MultipartFile object populated when using an java.util.Optional MutipartFile array or list
@RequestParam
Backported to: 4.3.12
1 votes, 3 watchers