我有这个NodeJS snippnet:
require('http').get({
secure: true,
host: 'github.com',
method: 'GET',
path: '/downloads/Graylog2/graylog2-web-interface/graylog2-web-interface-0.9.6.tar.gz',
'headers': {
Host: 'github.com'
}}).on('response', function(response) {
console.log(response.statusCode);
});
假设在https://github.com/downloads/Graylog2/graylog2-web-interface/graylog2-web-interface-0.9.6.tar.gz(样本)上执行简单的GET请求
我面临的问题是HTTP状态,使用NodeJS客户端 301 Moved Permanently 。我预计会发现 302 Found (实际上我得到的是Chrome,cUrl,http://web-sniffer.net,...)。
由于
答案 0 :(得分:0)
请求没有secure
选项。您想要的是使用https
模块。
require('https')