不带参数的mock请求:
config.json
[
{
"description":"这是Mock接口的Demo",
"request":{
"uri":"/GetDemo",
"method":"get"
},
"response":{
"text":"First get request"
}
}
]
在命令行输入如下:
带开浏览器输入如下:http://localhost:8080/GetDemo
页面显示
后台命令行输出如下请求过程:
待参数的get请求
http://localhost:8080/GetDemoparam?name=Anndy&&age=18
[
{
"description":"这是Mock接口的Demo",
"request":{
"uri":"/GetDemoparam",
"method":"get",
"queries":{
"name":"Anndy",
"age":"18"
}
},
"response":{
"text":"This is Get request name=Anndy"
}
}
]
带cookie信息的get请求
新建cookie: login=true(新建的cookie键值对) ,path(路径)=/,domain(域)=localhost
[
{
"description":"This is a get request with cookies",
"request":{
"uri":"/getwithcookies",
"method":"get",
"cookies":{
"login":"true"
}
},
"response":{
"text":"This is a response with cookies"
}
}
]