简介
这个工具我们可以完成绝大部分http请求,是一个不错的post-man替代工具
插件安装
在使用之前先确保 HTTP Client插件的安装,如果已经安装请无视这一步
> 安装后记得重启IDE编辑器确保插件可以正常使用
插件使用
描述: 所有HTTP请求需要在后缀为.http的文件中进行,新建一个test.http文件。基本格式为:
请求类型(如:GET, POST,PUT) + 请求地址(http://www.baidu.com)
请求头
...请求体
一般GET请求:
GET http://www.baidu.com?hi=hello
Accept: application/json
带状态的GET请求:
GET http://127.0.0.1:9085/api/item/list
Cookie: JessionId=TG4OKFVOZP6A9ML4
Authorization: Bearer TG4OKFVOZP6A9ML4
带body体的POST请求:
POST http://127.0.0.1:9085/login
Content-Type: application/json
{
"username":"zhangsan",
"sex":"boy"
}
模仿form表单POST请求:
POST http://127.0.0.1:9085/login
Content-Type: application/x-www-form-urlencoded
username=zhangsan&password=123
POST请求上传多类型:
POST http://127.0.0.1:9085/upload
Content-Type: multipart/form-data; boundary=WebAppBoundary
### text域
--WebAppBoundary
Content-Disposition: form-data; name="element-name"
Content-Type: text/plain
username=zhangsan
### json文件域
--WebAppBoundary
Content-Disposition: form-data; name="data"; filename="data.json"
Content-Type: application/json
快捷键大全:
gtr: 创建一个普通的GET请求,通过tab键一步步填写即可
gtrp: 功能同gtr,只不过多了一个参数位置的tab
ptr: 创建一个普通的post请求,内置了地址、请求头、json体的位置
ptrp: 形式同ptr,将json体的位置换成了key-value参数
mptr: 多类型post请求,内置:地址、请求头、一种请求类型(form-data)的位置
fptr: 上传文件post请求,样式同mptr,将请求类型的位置换成文件
demo合集:
POST http://localhost:8085/bc/test/testConsumeSchedule
Content-Type: application/json
###
POST http://localhost:8085/bc/test/testCostSchedule
Content-Type: application/json
###
POST http://localhost:8085/bc/test/t1?tableName=test123
Content-Type: application/x-www-form-urlencoded
###
POST http://localhost:8085/bc/test/testMail
Content-Type: application/x-www-form-urlencoded
###
POST http://localhost:8085/bc/consumeStatis/backData
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1Nzg0NTE0OSwiaWF0IjoxNTU3ODAxOTQ5LCJqdGkiOiIxIn0.gsg3XqwsratSyqFNuOWiOo9_fAd5XTLokPmVBYxvx6BQRquabliMNV_ULeoT4DNTnVKYy4W2-DzO5_wHaFVSng
Content-Type: application/x-www-form-urlencoded
date="20190513030000"
###
//
POST http://localhost:80/api/item
Content-Type: application/x-www-form-urlencoded
id=99&content=new-element
###
POST http://localhost:8085/bc/param/getOutPactList
Content-Type: application/x-www-form-urlencoded
{}
###
// 客户充值List
POST http://localhost:8085/bc/workFlow/listCustRecharge
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODEwMzA0OSwiaWF0IjoxNTU4MDU5ODQ5LCJqdGkiOiIxIn0.9VAZj8xf8YbcN201SACAlpJHUj1qDQ1zqH6SwwE7UfVegqHikTYtSeb8TX-B7DvPRveTkuAnvhB1hR2CoH_gwQ
{}
###
// 添加客户充值 记录
POST http://localhost:8085/bc/workFlow/addCustRecharge
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODEwMzA0OSwiaWF0IjoxNTU4MDU5ODQ5LCJqdGkiOiIxIn0.9VAZj8xf8YbcN201SACAlpJHUj1qDQ1zqH6SwwE7UfVegqHikTYtSeb8TX-B7DvPRveTkuAnvhB1hR2CoH_gwQ
{
"pactId":"1",
"pactMoney":"10",
"pactDesc":"合同金额1",
"rechargeMoney":"2000",
"rechargeDesc":"充值金额1",
"examineStatus":"0",
"imageList":[
{
"type":"1",
"fileName":"fileName1",
"filePath":"filePath1"
},
{
"type":"1",
"fileName":"fileName2",
"filePath":"filePath2"
},
{
"type":"1",
"fileName":"fileName3",
"filePath":"filePath3"
}
]
}
###
// 充值审批
POST http://localhost:8085/bc/workFlow/examineCustRecharge
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODEwMzA0OSwiaWF0IjoxNTU4MDU5ODQ5LCJqdGkiOiIxIn0.9VAZj8xf8YbcN201SACAlpJHUj1qDQ1zqH6SwwE7UfVegqHikTYtSeb8TX-B7DvPRveTkuAnvhB1hR2CoH_gwQ
{
"id":"2",
"examineStatus":"2",
"examineDesc":"确认没有问题"
}
###
// 撤回审批
GET http://localhost:8085/bc/workFlow/recallCustRecharge/2
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODEwMzA0OSwiaWF0IjoxNTU4MDU5ODQ5LCJqdGkiOiIxIn0.9VAZj8xf8YbcN201SACAlpJHUj1qDQ1zqH6SwwE7UfVegqHikTYtSeb8TX-B7DvPRveTkuAnvhB1hR2CoH_gwQ
###
// 客户修正List
POST http://localhost:8085/bc/workFlow/listCustEdit
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODcwOTg2OCwiaWF0IjoxNTU4NjY2NjY4LCJqdGkiOiIxIn0.YeyH-XfRiJBaQ3F-8CuhQBCrf3i0yZTX-XWxXzlBU7Fke87an1xudBn0KWYc0IriDeIksV6fQ-WJCXtnEmdzRA
{}
###
// 添加客户充值 记录
POST http://localhost:8085/bc/workFlow/addCustEdit
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODcwOTg2OCwiaWF0IjoxNTU4NjY2NjY4LCJqdGkiOiIxIn0.YeyH-XfRiJBaQ3F-8CuhQBCrf3i0yZTX-XWxXzlBU7Fke87an1xudBn0KWYc0IriDeIksV6fQ-WJCXtnEmdzRA
{
"pactId":"1",
"editMoney":"10",
"editDesc":"合同金额1",
"editType":"0",
"editMonth":"201904",
"examineStatus":"0",
"imageList":[
{
"type":"1",
"fileName":"fileName1",
"filePath":"filePath1"
},
{
"type":"1",
"fileName":"fileName2",
"filePath":"filePath2"
},
{
"type":"1",
"fileName":"fileName3",
"filePath":"filePath3"
}
]
}
###
// 修正审批
POST http://localhost:8085/bc/workFlow/examineCustEdit
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODcwOTg2OCwiaWF0IjoxNTU4NjY2NjY4LCJqdGkiOiIxIn0.YeyH-XfRiJBaQ3F-8CuhQBCrf3i0yZTX-XWxXzlBU7Fke87an1xudBn0KWYc0IriDeIksV6fQ-WJCXtnEmdzRA
{
"id":"1",
"examineStatus":"1",
"examineDesc":"确认没有问题"
}
###
// 撤回修正审批
GET http://localhost:8085/bc/workFlow/recallCustEdit/2
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImV4cCI6MTU1ODcwOTg2OCwiaWF0IjoxNTU4NjY2NjY4LCJqdGkiOiIxIn0.YeyH-XfRiJBaQ3F-8CuhQBCrf3i0yZTX-XWxXzlBU7Fke87an1xudBn0KWYc0IriDeIksV6fQ-WJCXtnEmdzRA
###