选择Http Request 3. 语法 每个请求都是以文本是形式存储起来,http后缀的文本文件,一个文件里面可以存储多个请求。 它的语法格式跟http请求的内容很接近 请求方法, 请求url,换行加上header参数,如果有body体,空一行加上body体 Method Request-URI HTTP-Version Header-field: Header-value Request-Body 1. 2. 3....
Name--WebAppBoundaryContent-Disposition:form-data;name="data";filename="data.json"Content-Type:application/json<./request-form-data.json--WebAppBoundary--### Send request with dynamic variablesinrequest's bodyPOST https://httpbin.org/postContent-Type:application/json{"id":{{$uuid}},"price":{...
创建名为 rest-client.env.json 或者 http-client.env.json 的环境文件(其实里面就是保存 JSON 数据),该文件里可以定义用在整个项目上的所有常规变量创建名为rest-client.private.env.json 或者 http-client.private.env.json, 看文件名你应该也猜到这是保存敏感数据的,比如密码,token等,该文件默认是被加入...
client.assert(response.body.code === 0, "Response code is not 0"); client.global.set("token", response.body.data); }); %} ### # 登陆后访问用户信息 POST http://{{host}}/system/user/info token: {{token}} > {% client.log(JSON.stringify(response.body)); client.test("Request e...
client.test(testName, func) // 创建一个名称为 testName 的测试 client.assert(condition, message) // 校验条件 condition 是否成立,否则抛出异常 message client.log(text) // 打印日志responseresponse.body // 字符串 或 JSON (如果content-type 为 application/json.) ...
GET http://httpbin.org/status/301 ### GET request with dynamic variables GET http://httpbin.org/anything?id={{$uuid}}&ts={{$timestamp}} ### POST ### Send POST request with json body POST https://httpbin.org/post Content-Type: application/json ...
GET http://httpbin.org/status/301 ### GET request with dynamic variables GET http://httpbin.org/anything?id={{$uuid}}&ts={{$timestamp}} ### POST ### Send POST request with json body POST https://httpbin.org/post Content-Type: application/json ...
client.global.set("token", response.body.token); %} 1. 2. 3. 4. 脚本检测 可以对返回值进行打印,断言; # 登陆 POST http://{{host}}/system/login Content-Type: application/x-www-form-urlencoded username=admin&password=123456 > {% ...
POST http://localhost:8082/ruben/user/login Content-Type:application/json;charset=UTF-8 { "username":"achao1441470436", "password":"VampireAchao123456." } >{% client.global.set("auth_token",response.body.token); client.log("token:"+response.body.token); ...
GET http://httpbin.org/status/301 ### GET request with dynamic variablesGET http://httpbin.org/anything?id={{$uuid}}&ts={{$timestamp}} ### 四、POST相关请求示例 ### Send POST request with json bodyPOST https://httpbin.org/postContent-Type:application/json {"id": 999,"value": "...