1.1.0 • Published 2 years ago

xn-api-test v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago
module.exports = () => {
  return {
    host: "https://example.com", //选填,data参数中api可以覆盖
    headers: {//选填,data参数中headers可以覆盖, 合并当前配置
      'Content-Type': "application/json"
    },
    responseType: 'json', //选填,data参数中responseType可以覆盖
    data: [
      {
        method: 'GET', //默认GET,可选
        api: "/api/userinfo", //必填
        // data:"foo=bar", //GET query or post/put body
        //or
        data: {
          foo: 'bar'
        },
        responseType: "",
        // expect: (response, responseHeaders) => {
        //   //do something with response and responseHeaders
        //   return true;
        // },
        expect: {
          "data.username=": "小明", //完全匹配
          "data.username^": "小明", //前缀匹配
          "data.username$": "小明",//后缀匹配
          "data.username*": "小明",//包含匹配
          "data.username!": "小明",//不包含
          "data.users.0.name=": "小明",//数组取值
          "$.header.set-cookie=": "sessionID=xxxxx", //$表示整个response
          "$.body*": "<html>", //
          "$.status": 200, //响应状态码
        }
      }
    ]
  }
}

GET https://example.com/api/userinfo?foo=bar

Resultruleexpectresponse content
OKa.b=cc
NOa.b=cd
1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago