depicts / got-tls

node api for proxying requests with golang to spoof tls fingerprint
MIT License
51 stars 4 forks source link

tough-cookie not working #2

Open fpena06 opened 3 years ago

fpena06 commented 3 years ago

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();
depicts commented 3 years ago

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

fpena06 commented 3 years ago

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.