问题
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