Skip to content
Discussion options

You must be logged in to vote

You need to pass secureOptions inside the https options object:

import crypto from 'node:crypto';
import got from 'got';

const gotFetched = await got(requestGetFeature, {
	https: {
		secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
	}
}).text().catch((e) => {
	console.log(e);
	return e;
});

The https object is where all TLS/SSL-related options go in Got. This includes things like rejectUnauthorized, certificateAuthority, secureOptions, etc.

If you have other options you want to merge, you can combine them:

const options = {
	https: {
		secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
	},
	timeout: {
		request: 10000
	}
	// ... other options
};

const gotFetched = a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sindresorhus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants