请求API挂起Restify

时间:2014-11-27 19:32:29

标签: node.js restify

我正在尝试使用Restify从HTTPS API请求一些信息。以下工作正常:

curl 'https://api.mercadolibre.com/sites/MLA/search?q=cartera&seller_id=156853713&limit=10&offset=0'

然而,这种情况仍然存在:

var client = restify.createClient({
   url: "https://api.mercadolibre.com"
});

search = function(response, name, store_id, limit, offset) {
    client.get("/sites/MLA/search?q=cartera&seller_id=156853713&limit=10&offset=0", function (err, req) {
    assert.ifError(err); // connection error
    var str = ''

    req.on('result', function (err, v_res) {
        assert.ifError(err); // HTTP status code >= 400

        v_res.on('data', function (chunk) {
            str += chunk;
        });

        v_res.on('end', function () {
            response.send(str)
        });
    });
});

}

出现以下错误:ECONNRESET。 谷歌搜索我发现这篇文章:Node.js Https request Error但答案似乎对我不起作用。

有什么想法吗? 感谢

0 个答案:

没有答案