Nodejs request module doesn't send Authorization header

点点圈 提交于 2019-12-02 07:43:49

问题


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'
  }
})

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


回答1:


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 } });



来源:https://stackoverflow.com/questions/27944086/nodejs-request-module-doesnt-send-authorization-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!