gpt4 book ai didi

ruby-on-rails - 在本地机器上进行精简 GZIP 解码

转载 作者:数据小太阳 更新时间:2023-10-29 07:38:26 26 4
gpt4 key购买 nike

我将 thin 用作 Rails 服务器,我想发送一些压缩的 JSON 数据,但在本地主机中它会出现 MultiJson 错误(未知符号)。

如何在没有 nginx 或 apache 的情况下为本地精简版启用 gzip 支持?

错误文本:

15:46:09 web.1     | Started PUT "/api/me" for 192.168.192.8 at 2011-11-25 15:46:09 +0600
15:46:09 web.1 | Error occurred while parsing request parameters.
15:46:09 web.1 | Contents:
15:46:09 web.1 |
15:46:09 web.1 |
15:46:09 web.1 | MultiJson::DecodeError (743: unexpected token at ''):

最佳答案

Rack 包含一个名为 Rack::Deflater 的中间件,这就是您想要的。

config/application.rb 中包含 config.middleware.use Rack::Deflater

关于ruby-on-rails - 在本地机器上进行精简 GZIP 解码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8267157/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com