节点JS请求模块将代理与请求一起使用

时间:2020-02-06 22:18:16

标签: node.js request

我正在尝试通过节点请求模块发送请求,并且正在尝试使用代理,我的代码是

const options = {
    headers: {
        'user-agent': 'Mozilla/ 5.0(Windows NT 10.0; Win64; x64) AppleWebKit / 537.36(KHTML, like Gecko) Chrome / 79.0.3945.130 Safari / 537.36'
    },
 proxy: 'AW3B5K.us.super.hexresi.com:19509:customer-cus_GcTVqLXBxRSBEj-asn-7922-sesstime-10:nc3ndO1C'

}

request.get('https://kith.com/products.json', options, (err, res, body) => {
    console.log(body)
})

我在chrome上测试了代理,并且可以正常工作,但是每当我在脚本中发送带有该请求的请求时,代理都无法工作,并且返回未定义

0 个答案:

没有答案