Nodejs请求模块不发送授权标头 [英] Nodejs request module doesn't send Authorization header

查看:28
本文介绍了Nodejs请求模块不发送授权标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在带有授权"标头的 https url 上发送 GET 请求.我尝试使用此代码执行此操作:

I need to send GET request on https url with "Authorization" header. I try to do this using this code:

request.get({
  url: url,
  headers: {
    'Authorization': token,
    'abc': 'def'
  }
})

在服务器端,我得到abc"标头,但没有授权标头.为什么会这样?

On server side I get "abc" header, but there is no Authorization header. Why does it happen?

推荐答案

您是否尝试过使用 auth 密钥?请参阅项目的自述文件中的详细信息示例<代码>request.get('http://some.server.com/', {'认证':{'用户':'用户名','pass': '密码','立即发送':假}});

Have you tried using auth key? See the details example in the project's readme request.get('http://some.server.com/', { 'auth': { 'user': 'username', 'pass': 'password', 'sendImmediately': false } });

这篇关于Nodejs请求模块不发送授权标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆