新建json文件命名为startupWithHeader,增加内容,代码如下:
[
{
"description":"这是一个带header信息的post请求",
"request":{
"uri":"/post/with/headers",
"method":"post",
"headers":{
"Content-Type":"application/json"
},
"json":{
"name":"wanglaosi",
"sex":"woman"
}
},
"response":{
"json":{
"wanglaosi":"success",
"status":"1"
}
}
}
]
在Terminal窗口输入输入java -jar -Dfile.encoding=UTF-8 ./moco-runner-0.11.0-standalone.jar http -p 8890 -c startupWithHeader.json回车
在jmeter里添加http请求和http信息头管理器