api request connection issue in nodejs

I’m trying to make a get request to a web url using basic auth. But it failed with connection issues.

Note: It works when i use ‘request’ library instead of ‘got’

What I’m I missing here ?

const got = require('got');

(async () => {
  try {
    const res = await got( 
                        url: 'https://<url>.com',
                        headers: {
                        Accept: 'application/json',
                        Authorization: 'Basic abcjghgh8****'
    console.log('statusCode:', res.statusCode);
        console.log('body:', res.body);
    } catch (error) {
        console.log('error:', error);



49 thoughts on “api request connection issue in nodejs”

  1. 686298 855014You may uncover two to three new levels inside L . a . Weight loss and any 1 someone is extremely critical. Initial stage may be real melting away rrn the body. shed weight 175337

  2. 312418 428086Youre so cool! I dont suppose Ive read anything like this before. So good to search out any individual with some original thoughts on this subject. realy thank you for starting this up. this internet site is one thing thats wanted on the internet, somebody with a bit of originality. useful job for bringing something new towards the internet! 845326