0

While using an API I am getting undefined rather then the status code like 200 or 404.

app.get('/', function(req, res){

    const url = ''; //The API key

    https.get(url, function(response){

        console.log(response.statuscode);
    });
    res.send('App is running');
});
1
  • 1
    Flagging as caused by a typo. Commented Jun 1, 2020 at 16:03

1 Answer 1

1

it should be : response.statusCode

const req = https.request(options, (response) => {
  console.log('statusCode:', response.statusCode);
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.