Got是一个人性化且功能强大的HTTP请求库。
安装
npm install got
使用
const got = require('got');
(async () => {
try {
const response = await got('sindresorhus.com');
console.log(response.body);
//=> '<!doctype html> ...'
} catch (error) {
console.log(error.response.body);
//=> 'Internal server error ...'
}
})();
链接: https://www.fly63.com/nav/1142