postman
postman是一款强大的http请求调度利器,与Fiddler一样,不过postman比较专注在开发领域,特别是项目 前后端分离时,后端程序员可以专注写后台逻辑的实现。
还有一个优点是,可以保存以前的项目发送的请求,这样便于在以后用到的时候 及时的找到。不用重新组装测试数据。
下载地址:https://www.postman.com/downloads/
选择要应的版本下载 ,当前2020.02.24最新版本是Version7.18.0,如果不是win平台,可以选择要应的mac或linux平台进行下载 。
postman 后台接口参数常用的设置如下
1.简单的get请求设置
java后台controller的代码
@RequestMapping(value = "changeDateList/{id}", method = RequestMethod.GET)
@ResponseBody
public String getChangeDateList(@PathVariable Integer id) {
return "gettests22";
}
postman对应get请求的如下图
2.postman针对参数类型为Map<string,string>的设置如下
@RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody
public ResultData<Map<String, String>> login(@RequestBody Map<String, String> parm) {
return userService.login(parm);
}
postman中关于Map<string,string的设置如下图,在raw中设置json数据
3.postman针对参数类型为List类型的设置如下
List包名import java.util.List;
@RequestMapping(value = "del", method = RequestMethod.POST)
@ResponseBody
public ResultBase del(@RequestBody List<String> ls) {
return userService.login(null);
}
postman中针对List<string>的设置如下图,在raw中设置数组数据,注意raw中的 中括号,表示数组
还不快抢沙发