我知道您可以像这样使用 -H header 在 cURL 中设置原点:
curl -H "Origin: http://foo.bar.com" --verbose \
https://example.com
是否有 node-libcurl
设置 -H header 的方法?这是我当前的获取请求:
const { curly } = require('node-libcurl')
async function test(){
mm = await curly.get('https://example.com')
console.log(mm)
}
test()
最佳答案
GET 请求的自定义 header 未记录。但是从POST request examples来看,我会尝试这样的事情:
const { curly } = require('node-libcurl')
curly.get('https://example.com', {
httpHeader: [
'Origin: http://foo.bar.com',
...
]
}).then(console.log)
关于node.js - 您可以使用 node-libcurl 设置源 header 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65054601/