fast-request icon indicating copy to clipboard operation
fast-request copied to clipboard

几点建议

Open ljynfo opened this issue 3 years ago • 1 comments

  1. 脚本中希望能获取到“项目”和“环境”变量的值
  2. 脚本可以支持实现 put("key",value),然后请求参数写{{key}}这种操作
  3. 脚本可以针对返回值进行断言
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"));
%}
###
  1. 可以直接在api接口上复制uri、请求参数、响应参数(场景是开发时发给前端),参考RestfulToolkit插件

ljynfo avatar Sep 06 '22 03:09 ljynfo

1:下个版本发 3:2022.2.5准备发console和打印机制 4:2022.2.4+就可以

kings1990 avatar Sep 10 '22 13:09 kings1990

@ljynfo 已支持

kings1990 avatar Aug 03 '23 03:08 kings1990