【问题标题】:restify mp4 response body is downloading in browser instead of playingrestify mp4 响应正文正在浏览器中下载而不是播放
【发布时间】:2017-11-06 22:39:05
【问题描述】:

我正在使用 restify 来提供视频网址。我希望它播放而不是下载,虽然我在设置 Content-Type: video/mp4 时对此感到困惑,但随后我在邮递员中进行测试时看到了我的问题。响应头有Content-Type: octect-stream

为什么 restify 没有采用我的标题设置或者我做错了什么?类似的问题here,但正如我所说,改变并没有发生。

这是我的简单代码:

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

【问题讨论】:

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


    【解决方案1】:

    所以我通过更新为 res.redirect 而不是 res.send 来实现这一点:

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

    【讨论】:

      猜你喜欢
      • 2015-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多