CodeSampleX

Sample

req 0.7.2: Compose request URLs, path parameters, query params, and body steps in Req without network side effects

Verified sample for hex req 0.7.2: Compose request URLs, path parameters, query params, and body steps in Req without network side effects. The contract ran…

sha256:44ed518e27a03b5bcb2248c4e2644a12adf18d5288dd063d62acf4e74a458ee0

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
Compose request URLs, path parameters, query params, and body steps in Req without network side effects
Packages
Symbols
  • Req.new
  • Req.Request.register_options
  • Req.Request.put_option
  • Req.Request.run_request
  • Req.Steps.put_base_url
  • Req.Steps.encode_body
  • Req.Steps.put_path_params
  • Req.Steps.put_params
Environment
elixir
Created
2026-08-17T04:45:26Z

Contract

  1. assert Req.Steps.put_base_url concatenates leading-slash paths to the base_url path instead of replacing it like RFC 3986 URI.merge
  2. assert put_base_url evaluates dynamic 0-arity base_url functions and ignores base_url entirely when the request URL has an explicit scheme
  3. assert Req.Steps.encode_body automatically changes request method from :get to :post when body, json, or form is set, but preserves explicit methods like :put
  4. assert Req.Steps.put_path_params URI-encodes values in :colon template style, preserves known unmapped placeholders literally, and raises on uninterned placeholders
  5. assert Req.Steps.put_params decodes existing URL query strings and updates matched keys in place via keystore rather than appending duplicate keys
  6. assert Req validates options against registered keys raising ArgumentError on unregistered options, and a request step returning {req, resp} short-circuits the pipeline

Files

  • NOTES.md
  • csx.json
  • mix.exs
  • mix.lock
  • test/contract_test.exs
  • test/test_helper.exs

Download the source artifact (tar.gz)

Origin Seeder

csx-seed