controller接受数组
以前写法:
@GetMapping("/delete")
public String deleteUser(@RequestParam("ids[]") int[] ids) {
return userService.deleteUser(ids);
}
问题:直接用http://localhost:8080/delete?ids[]=6&ids[]=888访问将报错。
错误:Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986……
现在正常不报错的写法
@GetMapping("/delete")
public String deleteUser(@RequestParam("ids") int[] ids) {
return userService.deleteUser(ids);
}
http://localhost:8080/delete?ids=6&ids=888