【发布时间】:2018-02-16 21:40:43
【问题描述】:
在我的 Node.js 应用程序中,我有一个路由,我从数据库 (Postgres) 获取大量 JSON 数据并以压缩格式在响应中发送它。我正在使用Zlib 模块来gzip 这个数据。我在发送响应之前设置Content-Type: application/gzip 和Content-Encoding: gzip。现在所有这些设置都适用于 Chrome 和 Safari 浏览器(成功解压缩数据),但由于某种原因,这在 Firefox 中不起作用。请求头包含Accept-Encoding: gzip, deflate。
在浏览器(Firefox)控制台中,我看到以下错误
Attempt to set a forbidden header was denied: Accept-Encoding 和
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
谁能指导我这是什么问题,我该如何解决?谢谢!
【问题讨论】:
标签: javascript angularjs json node.js firefox