Skip to content

Commit 9b04963

Browse files
committed
Mention options.rejectUnauthorized in the documentation
Fixes #1191
1 parent b9b6b1e commit 9b04963

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

readme.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,31 @@ Type: `string`
809809

810810
The IP address used to send the request from.
811811

812+
##### rejectUnauthorized
813+
814+
Type: `boolean`\
815+
Default: `true`
816+
817+
If set to `false`, all invalid SSL certificates will be ignored and no error will be thrown.\
818+
If set to `true`, it will throw an error whenever an invalid SSL certificate is detected.
819+
820+
We strongly recommend to have this set to `true` for security reasons.
821+
822+
```js
823+
const got = require('got');
824+
825+
(async () => {
826+
// Correct:
827+
await got('https://example.com', {rejectUnauthorized: true});
828+
829+
// You can disable it when developing an HTTPS app:
830+
await got('https://localhost', {rejectUnauthorized: false});
831+
832+
// Never do this:
833+
await got('https://example.com', {rejectUnauthorized: false});
834+
})();
835+
```
836+
812837
#### Response
813838

814839
The response object will typically be a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage), however, if returned from the cache it will be a [response-like object](https://github.com/lukechilds/responselike) which behaves in the same way.

0 commit comments

Comments
 (0)