fast-request
fast-request copied to clipboard
几点建议
- 脚本中希望能获取到“项目”和“环境”变量的值
- 脚本可以支持实现 put("key",value),然后请求参数写{{key}}这种操作
- 脚本可以针对返回值进行断言
https://www.jetbrains.com/help/idea/2022.2/http-response-handling-examples.html#script-var-example
### 登录
POST {{host-saas-dispatch-api-app}}/app/business/login/mobileVerifyLogin
Content-Encoding: utf-8
Content-Type:application/json
{
"mobile": {{mobile}},
"verifyCode": {{verifyCode}}
}
> {%
client.global.set("token", "Bearer " + response.body.token);
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "response.status is not 200");
client.assert(response.body.errorCode === 0, "response.body.errorCode is not 0");
client.assert(response.body.token.length > 10, "response.body.token.length !> 10");
});
client.log(client.global.get("token"));
%}
###
- 可以直接在api接口上复制uri、请求参数、响应参数(场景是开发时发给前端),参考RestfulToolkit插件
1:下个版本发 3:2022.2.5准备发console和打印机制 4:2022.2.4+就可以
@ljynfo 已支持