博客
关于我
JAVA接口自动化(八)Mock接口框架
阅读量:214 次
发布时间:2019-02-28

本文共 1785 字,大约阅读时间需要 5 分钟。

下载地址:

(1)带参数get方法

{		"description":"带参数",		"request":{			"uri":"/turan/test2",			"method":"get",			"queries":{				"name":"turan",				"age":"25"			},			},		"response":{			"text":"南京终于晴天了"		}	}

(2)带参数post方法

使用jmeter或者postman访问即,浏览器只能访问get请求

{	"description":"带参数",		"request":{			"uri":"/turan/test2",			"method":"post",				},		"forms":{				"name":"turan",				"age":"25"			},			}		"response":{			"text":"南京终于晴天了"		}	}]

(3)cookie的get请求

{    "description":"这是一个带cookies信息的get请求",    "request":{      "uri":"/get/with/cookies",      "method":"get",      "cookies":{        "login":"true"      }    },    "response":{      "text":"这是一个需要携带cookies信息才能访问的get请求"    }  }

在使用jmeter时候需要添加域和访问路径

(4)cookie的post请求

{    "description":"这是一个带cookies信息的post请求",    "request":{      "uri":"/post/with/cookies",      "method":"post",      "cookies":{        "login":"true"      },      "json":{        "name":"huhansan",        "age":"18"      }    },    "response":{      "status":200,      "json":{        "huhansan":"success",        "status":"1"      }    }  }

(5)带有header信息的请求

{    "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"      }    }  }

(6)请求重定向

{    "description":"重定向到百度",    "request":{      "uri":"/redirect"    },    "redirectTo":"http://www.baidu.com"  },  {    "description":"重定向到一个自己的网页上",    "request":{      "uri":"/redirect/topath"    },    "redirectTo":"/redirect/new"  },  {    "description":"这是被重定向到的请求",    "request":{      "uri":"/redirect/new"    },    "response":{      "text":"重定向成功啦"    }  }

转载地址:http://bfji.baihongyu.com/

你可能感兴趣的文章
netty——EventLoop概念、处理普通任务定时任务、处理io事件、EventLoopGroup
查看>>
netty——Future和Promise的使用 线程间的通信
查看>>
netty——Handler和pipeline
查看>>
Vue输出HTML
查看>>
netty——黏包半包的解决方案、滑动窗口的概念
查看>>
Netty中Http客户端、服务端的编解码器
查看>>
Netty中使用WebSocket实现服务端与客户端的长连接通信发送消息
查看>>
Netty中实现多客户端连接与通信-以实现聊天室群聊功能为例(附代码下载)
查看>>
Netty中的组件是怎么交互的?
查看>>
Netty中集成Protobuf实现Java对象数据传递
查看>>
netty之 定长数据流处理数据粘包问题
查看>>
Netty事件注册机制深入解析
查看>>
netty代理
查看>>
Netty入门使用
查看>>
netty入门,入门代码执行流程,netty主要组件的理解
查看>>
Netty原理分析及实战(一)-同步阻塞模型(BIO)
查看>>
Netty原理分析及实战(三)-高可用服务端搭建
查看>>
Netty原理分析及实战(二)-同步非阻塞模型(NIO)
查看>>
Netty原理分析及实战(四)-客户端与服务端双向通信
查看>>
Netty发送JSON格式字符串数据
查看>>