restify mp4响应体在浏览器中下载而不是播放

时间:2017-11-06 22:39:06

标签: google-chrome mime-types mp4 content-type restify

我正在使用restify来提供视频网址。我希望这可以玩而不是下载,当我在设置我的Content-Type: video/mp4时对此感到困惑,然后我在邮递员测试时看到了我的问题。响应标头有Content-Type: octect-stream

为什么要解决不采取我的标题设置或我做错了什么?类似的问题here,但正如我所说,改变没有采取。

这是我的简单代码:

    let headers = { 'Content-Type': 'video/mp4' };
    res.send(200, body, headers);

1 个答案:

答案 0 :(得分:0)

所以我通过更新到res.redirect而不是res.send来实现这个目的:

let headers = { 'Content-Type': 'video/mp4' };
res.redirect(302, body, next);
相关问题