Node.js 无法获取图像OCR计算机视觉API认知服务器节点JS

Node.js 无法获取图像OCR计算机视觉API认知服务器节点JS,node.js,microsoft-cognitive,botbuilder,Node.js,Microsoft Cognitive,Botbuilder,我正在使用计算机视觉Api,并试图使用node js将图像从url发布到ocr microsoft认知服务,但我得到了 {"code":"InvalidImageUrl","requestId":"a4c68f18-37c1-484d-a044-2f89df963915","message":"Can't fetch the image."} 这是我的邮政编码 http.get(url.parse(imageUrl), function (res) { res.on('data',fu

我正在使用计算机视觉Api,并试图使用node js将图像从url发布到ocr microsoft认知服务,但我得到了

{"code":"InvalidImageUrl","requestId":"a4c68f18-37c1-484d-a044-2f89df963915","message":"Can't fetch the image."}
这是我的邮政编码

http.get(url.parse(imageUrl), function (res) {
    res.on('data',function (body) {
        console.log('data from get '+body);
      })    
    res.on('end', function () {


        request.post({
            headers: {                    
                'Ocp-Apim-Subscription-Key': proccess.env.SUBSKEY
            },
            url: 'http://api.projectoxford.ai/vision/v1.0/ocr?language=unk&detectOrientation=true',
            encoding: 'binary',
            formdata:{
                file:res
            }
        }, function (error, response, body) {
            if(error)
            {
                console.log(error);
            }
            console.log('data from post '+body);
        });
    });
});

此外,我正在使用botbuilder,如果有人有同样的错误,我将使用请求管道而不是http get解决这个问题,并将post选项移动到var

request.get(imageUrl).pipe(request.post(postOptions,function(error,response,body) {  

           /*Do some cool stuff
            */
}
));

嗨,如果有人有同样的错误,我会使用请求管道而不是http get解决这个问题,并将post选项移动到var

request.get(imageUrl).pipe(request.post(postOptions,function(error,response,body) {  

           /*Do some cool stuff
            */
}
));