1.0.12 • Published 4 months ago

best-request v1.0.12

Weekly downloads
1
License
-
Repository
-
Last release
4 months ago

bestpay 前端请求库,包括入向网关、PC 网关请求。

安装

npm install best-request

使用

import BestRequest from "best-request";
// 请求基础参数,具体请求参数参考dist/http/index.d.ts
const baseConfig = {
  baseURL: "请求根地址",
  token: "请求toekn",
  tenantId: "租户id",
  data: {}, // 请求参数
  env: {
    yzfPublicKey: "xxx",
    certificateSerial: "xxx",
    app_id: "",
    env: "环境标", // 生产不需要
    sessionKey: "xxx", // pc网关需要
    userId: "xxx", // pc网关需要
  },
};

const url = "每个接口后缀地址";
await BestRequest.requestBridge({
  url,
  ...baseConfig,
});
// 加密方法,请求拦截器中可使用
BestRequest.getGwPcEncryptParam(
  JSON.stringify(baseConfig.data),
  baseConfig.env
);
// 解密方法,响应拦截器中可使用
BestRequest.gwPcDecrypt(res.data.result)
1.0.12

4 months ago

1.0.11

8 months ago

1.0.10

10 months ago

1.0.9

11 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

3.1.0

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago