CodeSampleX

Sample

req 0.7.2: Handle Req defaults for redirect credential stripping, method rewrites, redirect limits, opt-in compression, and user-agent value validation

Verified sample for hex req 0.7.2: Handle Req defaults for redirect credential stripping, method rewrites, redirect limits, opt-in compression, and…

sha256:3f145e36efe27122e4ece7c6ac75d71229c265eb14001e46d2c75d0ba58c5e7c

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
Handle Req defaults for redirect credential stripping, method rewrites, redirect limits, opt-in compression, and user-agent value validation
Packages
Symbols
  • Req.new
  • Req.Request.get_header
  • Req.Steps.redirect
  • Req.Steps.compressed
  • Req.Steps.put_user_agent
  • Req.TooManyRedirectsError
Environment
elixir
Created
2026-08-17T04:46:01Z

Contract

  1. assert cross-origin HTTP redirects strip sensitive Authorization headers by default unless redirect_trusted: true is set
  2. assert same-origin redirects preserve Authorization headers while cross-origin redirects to a different host strip them
  3. assert 301, 302, and 303 redirects convert POST requests to GET and clear the body payload while 307 and 308 preserve POST method and body
  4. assert redirect defaults to true and following redirects can be disabled by setting redirect: false
  5. assert redirect loops halt and raise Req.TooManyRedirectsError when exceeding max_redirects default of 10
  6. assert compressed defaults to false and leaves accept-encoding unset, while compressed: true advertises supported encodings including gzip
  7. assert put_user_agent uses a Req version header by default and raises FunctionClauseError when user_agent: false is treated as a non-binary header value

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