How to print the Status Code of API response

We may get response from an API while making an https request. We can do console.log and view the whole https response. Looking at the whole response may look bit complicated.

So in case if we just need to print the status code of the response. We can use console.log(response.statusCode);

   

   https.get(url, function(response){
        console.log(response.statusCode);
    })

About the Author: smartcoder

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *