添加 requestTest.js

pull/366/head
王良 2 months ago
parent 9aab611b17
commit fc4419abde

@ -0,0 +1,26 @@
const request = require('request')
const HttpsAgent = require('@docmirror/mitmproxy/src/lib/proxy/common/ProxyHttpsAgent')
const options = {
url: 'https://raw.githubusercontent.com/docmirror/dev-sidecar/refs/heads/master/packages/core/src/config/remote_config.json5',
// url: 'https://gitee.com/wangliang181230/dev-sidecar/raw/docmirror/packages/core/src/config/remote_config.json5',
servername: 'baidu.com',
agent: new HttpsAgent({
keepAlive: true,
timeout: 20000,
keepAliveTimeout: 30000,
rejectUnauthorized: false
})
}
if (options.agent.options) {
options.agent.options.rejectUnauthorized = false
console.info('options.agent.options.rejectUnauthorized = false')
}
request(options, (error, response, body) => {
console.info('error:', error,
'\n---------------------------------------------------------------------------\n' +
'response:', response,
'\n---------------------------------------------------------------------------\n' +
'body:', body)
})
Loading…
Cancel
Save