用的是express框架,读取https://pin.aliyun.com/get_img?sessionid=1这个图片的内容,用http://localhost/identify 把图片显示出来,代码如下,运行后图片显示框框,没显示出图片:
router.get('/identify',function(req,res,next){
var opts={
url:'https://pin.aliyun.com/get_img?sessionid=1'
}
request.get(opts, function (err, response, body) {
var type = response.headers["content-type"];
res.writeHead(200,{"Content-Type":type});
res.write(body);
res.end();
})
})
多加点日志打印调试一下