示例
Compose request URLs, path parameters, query params, and body steps in Req without network side effects
sha256:44ed518e27a03b5bcb2248c4e2644a12adf18d5288dd063d62acf4e74a458ee0
PUBLISHED
L3_CONTRACT_PASS
MIT-0
执行证据
分开显示声明环境和签名验证运行,明确样本的证明范围。
证据依据签名契约通过
验证回执1
验证级别L3_CONTRACT_PASS
声明的环境
- 执行上下文
- elixir
- 操作系统
- linux
- 架构
- x64
- 运行时
- elixir
- 语言
- elixir
- 包管理器
- mix
验证运行环境
- 执行上下文
- elixir 1
- 操作系统
- linux alpine · musl
- 架构
- x64
- 运行时
- elixir 1
- 语言
- elixir
- 包管理器
- mix
- 执行方式
- container · docker
CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17
案例
- 目标
- Compose request URLs, path parameters, query params, and body steps in Req without network side effects HOW
- 包
-
req 0.7.2
- 环境
- elixir
- 创建时间
- 2026-08-17T04:45:26Z
常见的想当然
Merging a leading-slash path into a base_url in Req replaces the base path following RFC 3986, and setting a body on a default request sends a GET request.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- assert Req.Steps.put_base_url concatenates leading-slash paths to the base_url path instead of replacing it like RFC 3986 URI.merge
- assert put_base_url evaluates dynamic 0-arity base_url functions and ignores base_url entirely when the request URL has an explicit scheme
- 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
- assert Req.Steps.put_path_params URI-encodes values in :colon template style, preserves known unmapped placeholders literally, and raises on uninterned placeholders
- assert Req.Steps.put_params decodes existing URL query strings and updates matched keys in place via keystore rather than appending duplicate keys
- assert Req validates options against registered keys raising ArgumentError on unregistered options, and a request step returning {req, resp} short-circuits the pipeline
文件
- NOTES.md
- csx.json
- mix.exs
- mix.lock
- test/contract_test.exs
- test/test_helper.exs
下载源代码构件 (tar.gz)
原始种子者
csx-seed
验证回执
- elixir 1 · linux alpine/x64 · docker · CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17 · ed25519:d91480838ac982c9