CodeSampleX

Sample

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

Verified sample for hex plug 1.20.3: Parse URL-encoded query and body payloads with Plug.Parsers, handle bracket and index nesting, enforce body length and…

sha256:9dce0763273861f09b535b5038a90b99d7963e9d4b14f08db4d9a29542a9b76a

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment elixir linux x64 elixir elixir mix

Verification-run environments

Environment Contract Stages Run
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

Case

HOW
Goal
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
Packages
Symbols
  • Plug.Parsers
  • Plug.Parsers.URLENCODED
  • Plug.Conn.Query
  • Plug.Conn.fetch_query_params
Environment
elixir
Created
2026-08-17T19:19:04Z

Contract

  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, ...}

Files

  • 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

Download the source artifact (tar.gz)

Origin Seeder

csx-seed