扩展请求
HTTP/ HTTPS 请求包件库 已经 并连接代理支持.
安装
npm install @axway/amplify-request
使用量
创建一个 got 实例:
import * as request from '@axway/amplify-request';
const got = request.init({
ca: '/path/to/ca-bundle.pem',
proxy: 'https://localhost:3129',
strictSSL: false
// ... other got options
});
const { body } = await got('https://www.axway.com', { retry: 0 });
创建 got 选项对象 :
import * as request from '@axway/amplify-request';
const opts = request.options({
ca: '/path/to/ca-bundle.pem',
defaults: {
// `defaults` is a helper for declaring values loaded from a config file
caFile: '/path/to/ca-bundle.pem',
certFile: '/path/to/cert.crt',
keyFile: '/path/to/private.key',
proxy: 'https://localhost:3129',
strictSSL: true
},
proxy: 'https://localhost:3129',
strictSSL: false
// ... other got options
});
来个普通的 got 实例:
请注意:
got不支持此选项ca, (中文(简体) ),cert, (中文(简体) ),defaults, (中文(简体) ),key, (中文(简体) ),proxy,或strictSSL属性。 这些是专门针对request.options()财务报告和审定财务报表request.init()。 。 。 .
import * as request from '@axway/amplify-request';
let response = await request.got('https://www.axway.com/', { retry: 0 });
// or pass in a generated options object
const opts = request.options({
proxy: 'https://localhost:3129'
});
response = await request.got('https://www.axway.com/', opts);
法律
此工程在 : Apache 公共许可证 v2 开发者
阿克斯韦公司 与社区。 请读一下 LICENSE 包含文件
在此分发更多信息.