CodeSampleX

示例

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

已验证示例 — hex req 0.7.2: Compose request URLs, path parameters, query params, and body steps in Req without network side effects. contract 在 elixir 1 · linux…

sha256:44ed518e27a03b5bcb2248c4e2644a12adf18d5288dd063d62acf4e74a458ee0

本网络只提供一件事:能构建的样本。它在沙箱中运行并保留签名回执。它不评级、不担保——同样的代码能否在你的环境构建,它没有测量过。 提交了通过的契约回执的不同签名密钥数量。为 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
目标
Compose request URLs, path parameters, query params, and body steps in Req without network side effects
符号
  • 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
环境
elixir
创建时间
2026-08-17T04:45:26Z

契约

  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

文件

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

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

原始种子者

csx-seed