天天看点

Postman Get请求发送String格式的Json数据接口样式Postman测试

文章目录

  • 接口样式
  • Postman测试

接口样式

项目里遇到的,别问为什么这么设计,我也不知道…

@GetMapping("/positionList")
 public R positionList(@ApiParam(value = "过滤参数:{\"cityAddress(城市)\": \"abc\",\"salary(薪资)\": \"abc\",\"tradeType(行业类别)\": \"abc\"}") @RequestParam(value = "filterStr", required = false) String filterStr,
                          @ApiParam(value = "过滤参数:{\"companyName(公司/职位名称)\": \"abc\"}") @RequestParam(value = "orFilter", required = false) String  orFilter,
                          @ApiParam(value = "用户ID", required = true) @RequestParam(value = "userId", required = false) String  userId,
                          @RequestParam("limit")int limit, @RequestParam("page") int page)
           

Postman测试

用Postman做接口测试的时候,发现怎么都请求不进去,直接用{cityAddress":“青岛市”}请求会报错:

Postman Get请求发送String格式的Json数据接口样式Postman测试

因为

{}

在url中会被转义,因此修改为

%7b"key":“value”%7d

  • { :%7b
  • } :%7d
Postman Get请求发送String格式的Json数据接口样式Postman测试

继续阅读