CodeSampleX

示例

plug 1.20.3: Parse URL-encoded query and body payloads with Plug.Parsers, handle bracket and index nesting, enforce body length and media type constraints, and merge parameters with body precedence

已验证示例 — hex plug 1.20.3: Parse URL-encoded query and body payloads with Plug.Parsers, handle bracket and index nesting, enforce body length and media type…

sha256:9dce0763273861f09b535b5038a90b99d7963e9d4b14f08db4d9a29542a9b76a

本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。 提交了通过的契约回执的不同签名密钥数量。为 1 表示只有作者;大于 1 表示还有其他人构建过。密钥是自行生成的,背后没有注册身份,因此计的是密钥而非人。 MIT-0

执行证据

声明的环境与签名的运行分开呈现,你可以看到这个样本究竟运行了什么、在哪里运行。

证据依据
签名契约通过
验证回执
2
构建过它的签名密钥
2
声明的环境 elixir linux x64 elixir elixir mix

验证运行环境

环境 契约 阶段 运行日期
elixir 1 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-17
elixir 1 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:PASS · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · hex@1
2026-08-18

案例

HOW
目标
Parse URL-encoded query and body payloads with Plug.Parsers, handle bracket and index nesting, enforce body length and media type constraints, and merge parameters with body precedence
符号
  • Plug.Parsers
  • Plug.Parsers.URLENCODED
  • Plug.Conn.Query
  • Plug.Conn.fetch_query_params
环境
elixir
创建时间
2026-08-17T19:19:04Z

契约

  1. assert Plug.Parsers decodes nested maps and array brackets into structured maps while assigning body parameters precedence over query parameters on key collisions during merged parameter resolution
  2. assert indexed bracket syntax produces a string-keyed map rather than a list in Plug.Conn.Query
  3. assert Plug.Parsers.init/1 raises ArgumentError when the :parsers option is missing or empty
  4. assert non-UTF8 urlencoded payloads raise Plug.Parsers.BadEncodingError with plug_status 400
  5. assert unhandled media types raise Plug.Parsers.UnsupportedMediaTypeError unless matching the :pass whitelist which leaves body_params unfetched
  6. assert body payloads exceeding the :length limit raise Plug.Parsers.RequestTooLargeError
  7. assert custom parser modules implementing Plug.Parsers behaviour can return {:ok, ...}, {:error, :too_large, ...}, or delegate with {:next, ...}

文件

  • NOTES.md
  • csx.json
  • lib/csx_plug_parsers/csv_parser.ex
  • lib/csx_plug_parsers/pipeline.ex
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

下载源代码构件 (tar.gz)

原始种子者

csx-seed