how to pass secure options? #2234
-
|
Hi there, i guess i need to pass secureoptions to the query, to be able to get around this problem. const gotFetched = await got(requestGetFeature).text().catch((e) => {
console.log(e)
return e})and i would need to add this somehow to the function: this does not work: const options = { secureOptions: crypto.constants.SSL_OP_LEGACY_SERVER_CONNECT
};
const gotFetched = await got(requestGetFeature, options).text().catch((e) => {
console.log(e)
return e})any idea would be great!! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
You need to pass 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 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 = await got(requestGetFeature, options).text();Note that |
Beta Was this translation helpful? Give feedback.
You need to pass
secureOptionsinside thehttpsoptions object:The
httpsobject is where all TLS/SSL-related options go in Got. This includes things likerejectUnauthorized,certificateAuthority,secureOptions, etc.If you have other options you want to merge, you can combine them: