nodejs request 设置证书免验证 和 30x 不跳转

image.png

代码

const request = require('request');
const Promise = require("bluebird");
const httpPOST = Promise.promisify(request.post);
const httpGET = Promise.promisify(request.get);

const options = {
		header: {},
		method: 'GET',
		uri: this.signUrl,
		gzip : true,
		followRedirect: false,
		followAllRedirects: false,
		agentOptions: {
			rejectUnauthorized: false
		},
		timeout: 20000
	}
	let ret = await httpGET(options);

https://www.npmjs.com/package/request#using-optionsagentoptions
https://nodejs.org/api/tls.html#tls_tls_connect_options_callback