Hello,
I'm using got since several months and I love it !
I'm facing an issue with an https request with an invalid SSL certificate.
If I use Postman or Curl I can ignore the SSL check, but I don't find a way to ignore with got library.
on chrome I recevied this : ERR_CERT_AUTHORITY_INVALID
Any ideas ?
Thanks in advance !
@sindresorhus Sorry for troubling, but there is conflicting information available on the interwebz. Node.js docs state that to be able to use the rejectUnauthorized option, you need to provide a custom Agent. Yet, some of the resources available say that it is unnecessary.
In relation to got, is the correct way to pass the rejectUnauthorized option directly to got, or should I pass an Agent configured with the rejectUnauthorized option?
Thank you.
I don't know, sorry. Whatever is correct for Node.js, is correct for Got.
For others coming here in search of an answer: got('https://local.dev', { rejectUnauthorized: false });
ps:
got ships with Typescript definition files which are a nice way to explore modules' APIs.
In this case got() takes a second argument of type OptionsOfDefaultResponseBody, and if you drill down this type you will eventually rejectUnauthorized under node's https.RequestOptions type.
For others coming here in search of an answer: got('https://local.dev', { rejectUnauthorized: false });
wow, this should be top-level documented.
Now it's actually:
got('https://local.dev', {https: { rejectUnauthorized: false }});
Most helpful comment
For others coming here in search of an answer:
got('https://local.dev', { rejectUnauthorized: false });ps:
gotships with Typescript definition files which are a nice way to explore modules' APIs.In this case
got()takes a second argument of typeOptionsOfDefaultResponseBody, and if you drill down this type you will eventuallyrejectUnauthorizedunder node'shttps.RequestOptionstype.