Added cookie support to CLI requests

This commit is contained in:
Matthew Dickinson
2024-10-18 17:46:51 -04:00
parent ac67c4c0d8
commit b82a2c3312
4 changed files with 124 additions and 0 deletions

View File

@@ -211,6 +211,11 @@ const builder = async (yargs) => {
description:
'The specified custom CA certificate (--cacert) will be used exclusively and the default truststore is ignored, if this option is specified. Evaluated in combination with "--cacert" only.'
})
.option('use-cookies', {
type: 'boolean',
default: false,
description: 'Automatically save and sent cookies with requests'
})
.option('env', {
describe: 'Environment variables',
type: 'string'
@@ -301,6 +306,7 @@ const handler = async function (argv) {
filename,
cacert,
ignoreTruststore,
useCookies,
env,
envVar,
insecure,
@@ -392,6 +398,9 @@ const handler = async function (argv) {
if (insecure) {
options['insecure'] = true;
}
if (useCookies) {
options['useCookies'] = true;
}
if (cacert && cacert.length) {
if (insecure) {
console.error(chalk.red(`Ignoring the cacert option since insecure connections are enabled`));