Próbowałem już the sample from the documentation i działa świetnie.Prośba o żądanie Https błędu Node.js
Po zmianie adresu URL na https://api.mercadolibre.com/sites/
żądanie zawiesza się. Jedyne co mi się dostać to:
{ [Error: socket hang up] code: 'ECONNRESET' }
Oto mój kod:
var https = require('https');
this.dispatch = function(req, res) {
var renderHtml = function(content) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(content, 'utf-8');
}
var parts = req.url.split('/');
var options = {
host: 'api.mercadolibre.com',
port: 443,
path: '/sites/',
method: 'GET'
};
var request = https.request(options, function(res) {
console.log("statusCode: ", res.statusCode);
console.log("headers: ", res.headers);
res.on('data', function(d) {
process.stdout.write(d);
});
});
request.on('error', function(e) {
console.error('error');
console.error(e);
});
request.end();
return 'item id:' + parts[2];
};
Próbowałem z curl, SoapUI iz przeglądarce. We wszystkich przypadkach działa świetnie, ale z node.js tak nie jest.
Jak mogę uzyskać więcej danych o tym, co się dzieje?
dodany
z dyni i zrobić curl --sslv3 https://api.mercadolibre.com/sites/ prac. Testowałem to samo w centos 6 i też działa. Zainstalowałem ponownie węzeł, tym razem ze źródła, ten sam problem. Mój Os to ubuntu 12.04. Dzięki.
Musisz pokazać u s, którego używasz, abyśmy mogli zdiagnozować problem. – Ashe