got-tls
got-tls copied to clipboard
tough-cookie not working
When trying to use it with tough-cookie I get the following error. UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'secure' of undefined
'use strict'
const { Server, got } = require('got-tls');
const tough = require('tough-cookie');
async function run() {
Server.connect();
let cookie = new tough.CookieJar();
let response = await got.get('http://ja3er.com/', {
headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:82.0) Gecko/20100101 Firefox/82.0'
},
debug: true,
redirect: false,
cookieJar: cookie,
});
}
run();
you are getting this issue when the request is ran ? ive seen this issue when trying to get the cookies from the jar but its usually cause from not passing in the current url to the getCookies function
So the issue only seems to happen when using in a .js file. If you copy my snippet and save to a .js you can reproduce the error. With the .ts sample seems to work fine.