【问题标题】:In the `cowboy_req` module, how does one set the 'length' and 'period' values in app config?在 `cowboy_req` 模块中,如何在应用配置中设置 'length' 和 'period' 值?
【发布时间】:2021-01-30 12:00:03
【问题描述】:

我遇到了 HTTP 413 错误,消息 payload_too_large 从 Cowboy 冒泡。看来我的 HTTP 客户端正在上传一个比默认值 64K 更长的正文,我还没有弄清楚如何增加该值。

【问题讨论】:

    标签: erlang elixir phoenix cowboy


    【解决方案1】:

    函数cowboy_req:read_bodycowboy_req:read_urlencoded_body 有带有两个参数的变体,第二个参数是选项映射。您可以将最大尺寸指定为length:

    cowboy_req:read_urlencoded_body(Req, #{length => 100000})
    

    更多详情请见Cowboy documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-18
      • 1970-01-01
      • 2013-03-25
      • 2014-05-27
      • 2017-09-27
      相关资源
      最近更新 更多