Skip to content

Commit

Permalink
Support --insecure
Browse files Browse the repository at this point in the history
Disables TLS certificate verification.
  • Loading branch information
mmalecki committed Jan 17, 2020
1 parent bbf4de0 commit 07ee143
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/http-console
Expand Up @@ -6,15 +6,17 @@ const argv = require('minimist')(process.argv.slice(2), {
alias: {
verbose: 'v',
help: 'h',
insecure: 'k',
},
boolean: ['verbose', 'help', 'json'],
boolean: ['verbose', 'help', 'json', 'insecure'],
default: {
json: false,
openapi: false,
verbose: false,
help: false,
timeout: 5000,
history: true
history: true,
insecure: false,
}
})

Expand All @@ -37,6 +39,7 @@ const help = [
' --openapi enable OpenAPI autocompletion',
' --no-history disable history',
' --history <name> use named history',
'-k, --insecure disable TLS certificate verification',
'-h, --help display this message'
].join('\n');

Expand All @@ -45,6 +48,7 @@ let options = {
timeout: argv.timeout,
verbose: argv.verbose,
completers: [ new HistoryCompleter() ],
rejectUnauthorized: !argv.insecure
};

if (typeof process.env.NO_COLOR !== 'undefined') options.colors = false
Expand Down
1 change: 1 addition & 0 deletions lib/http-console.js
Expand Up @@ -22,6 +22,7 @@ class HTTPConsole {
prefixUrl: this.baseUrl,
throwHttpErrors: false,
timeout: options.timeout,
rejectUnauthorized: options.rejectUnauthorized === true,
})
this.json = options.json === true
this.verbose = options.verbose === true
Expand Down

0 comments on commit 07ee143

Please sign in to comment.