vue前端通过request请求后台接口时,url路径错误导致后台报错,原因是将url中的“listStoreOption”作为一个get请求参数来解析了,没有作为路径,因为在后台也没有正确处理对应请求的路径,异常详情如下:
15:43:05.852 [http-nio-8080-exec-20] ERROR c.r.f.w.e.GlobalExceptionHandler - [handleException,83] - Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: "listStoreOption"
org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: "listStoreOption"
错误的request请求url如下:
export function listLineOption(query) {
return request({
url: '/base/device/listLineOption',
method: 'get',
params: query
})
}
正确的url为:
url: ‘/base/line/listLineOption’,