问题是Restify不接受HTTP ACCEPT标头,图像呈现代码很好.
我有一个编码为base64字符串的图像,我想使用node.js将其作为图像提供.目前我有以下代码(我正在使用Restify),它可以在Chrome中呈现图像,但图像无法在其他浏览器中呈现(尝试IE9,Firefox 4,Android浏览器):
var decodedBuffer = new Buffer(dataString,"base64");
res.send({
code: 200,
headers: {'Content-Type': 'image/png', 'Content-Length': decodedBuffer.length},
noEnd: true
});
res.write(decodedBuffer);
res.end();
Run Code Online (Sandbox Code Playgroud)
任何人都能够了解我可能做错了什么?
谢谢