背景
新建的springboot项目,通过swagger调试接口的时候,发现GET请求,我只传递了id一个参数,然后在swagger中,该接口的url的后缀竟然变成了{?id},
当我请求接口的时候就直接报错了:
java.lang.IllegalArgumentException: Invalid character found in the request target [/official/admin/api/news/getById%7B?id}&id=1 ]. The valid characters are defined in RFC 7230 and RFC 3986
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:494) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
at org.apache.coyote.http11.Http11Processor