git bash发送restful请求报错:Required Integer parameter 'pageSize' is not present
·
##使用git bash发送时会获取不到pageSize的值,必须要将路径中的特殊符号进行转义;
##使用浏览器自带的发送工具(如firefox插件RESTClient)就无问题;
转义后即可操作成功:
curl -H "Content-Type:application/json" -X GET http://localhost:9999/stock/list?pageNo=2\&pageSize=6
java controller代码:
@RestController
@RequestMapping(value = "/stock")
public class StockController {
private static final Logger log = LoggerFactory.getLogger(StockController.class);
@Autowired
private StockService stockService;
/**
*
* @param tablelog
* @param pageNo
* 页数
* @param pageSize
* 每页条数
* @return
*/
@GetMapping("/list")
public Result list(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize) {
log.info("pageNo:{} pageSize:{}", pageNo, pageSize);
List<Stock> list = stockService.findAll(pageNo, pageSize);
log.info("{}", list);
return Result.ok(list);
}
更多推荐
已为社区贡献3条内容
所有评论(0)