1const got = require('got');
2
3(async () => {
4 try {
5 const response = await got('https://sindresorhus.com');
6 console.log(response.body);
7 //=> '<!doctype html> ...'
8 } catch (error) {
9 console.log(error.response.body);
10 //=> 'Internal server error ...'
11 }
12})();