博客
关于我
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/

你可能感兴趣的文章
MYSQL 幻读(Phantom Problem)不可重复读
查看>>
mysql 往字段后面加字符串
查看>>
mysql 快照读 幻读_innodb当前读 与 快照读 and rr级别是否真正避免了幻读
查看>>
MySQL 快速创建千万级测试数据
查看>>
mysql 快速自增假数据, 新增假数据,mysql自增假数据
查看>>
MySql 手动执行主从备份
查看>>
Mysql 批量修改四种方式效率对比(一)
查看>>
Mysql 报错 Field 'id' doesn't have a default value
查看>>
MySQL 报错:Duplicate entry 'xxx' for key 'UNIQ_XXXX'
查看>>
Mysql 拼接多个字段作为查询条件查询方法
查看>>
mysql 排序id_mysql如何按特定id排序
查看>>
Mysql 提示:Communication link failure
查看>>
mysql 插入是否成功_PDO mysql:如何知道插入是否成功
查看>>
Mysql 数据库InnoDB存储引擎中主要组件的刷新清理条件:脏页、RedoLog重做日志、Insert Buffer或ChangeBuffer、Undo Log
查看>>
mysql 数据库中 count(*),count(1),count(列名)区别和效率问题
查看>>
mysql 数据库备份及ibdata1的瘦身
查看>>
MySQL 数据库备份种类以及常用备份工具汇总
查看>>
mysql 数据库存储引擎怎么选择?快来看看性能测试吧
查看>>
MySQL 数据库操作指南:学习如何使用 Python 进行增删改查操作
查看>>
MySQL 数据库的高可用性分析
查看>>