From fc4419abdef4ef18d16bf5eb4bf3c037b33087d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Wed, 25 Sep 2024 09:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20requestTest.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/test/requestTest.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/core/test/requestTest.js diff --git a/packages/core/test/requestTest.js b/packages/core/test/requestTest.js new file mode 100644 index 0000000..d2914af --- /dev/null +++ b/packages/core/test/requestTest.js @@ -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) +})