const request = require('request');
// 自定义headers
const customHeaders = {
'User-Agent': 'My-App/1.0',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
};
// 请求选项
const options = {
url: 'http://example.com', // 目标URL
headers: customHeaders // 指定headers
};
// 发送请求
request(options, function(error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
01-21
05-16
1522
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)