CodeSampleX

샘플

req 0.7.2: Show that path placeholders in Req require an explicit style and are not normalized across syntaxes.

검증된 샘플 — hex req 0.7.2: Show that path placeholders in Req require an explicit style and are not normalized across syntaxes. elixir 1 · linux alpine/x64 …

sha256:8d74bb316cf0eb5ddaf0f5e7352fd2d7c0b907fed64b069760446631634aae5b

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. 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
목표
Show that path placeholders in Req require an explicit style and are not normalized across syntaxes.
패키지
심벌
  • Req.get!
  • Req
환경
elixir
생성일
2026-08-17T04:45:26Z

컨트랙트

  1. Curly placeholders in the URL are not interpolated by default, so `{id}` stays unreplaced when `path_params_style` is omitted.
  2. Using `path_params_style: :curly` with the same `path_params` expands `{id}` into `/items/1` in the request URL.

파일

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

소스 아티팩트 내려받기 (tar.gz)

소스

NOTES.md
Sample hit found with `search_known_solution`: `sha256:44ed518e27a03b5bcb2248c4e2644a12adf18d5288dd063d62acf4e74a458ee0`.
A wrong assumption is that `path_params` interpolates `{id}` by default, but with default `:colon` style Req leaves that curly token unresolved.
csx.json
{"buildCommand":["mix","deps.compile","--no-deps-check"],"case":{"believed":"Providing `path_params` should replace a URL placeholder like `{id}` even when `path_params_style` is not set.","caseId":"case:sha256:05ba7c8abcfdcc587b0f13da1793fe37fa0d8cd215725fcf7e77f1fe426c6ea3","contract":["Curly placeholders in the URL are not interpolated by default, so `{id}` stays unreplaced when `path_params_style` is omitted.","Using `path_params_style: :curly` with the same `path_params` expands `{id}` into `/items/1` in the request URL."],"goal":"Show that path placeholders in Req require an explicit style and are not normalized across syntaxes.","kind":"HOW","packages":["pkg:hex/req@0.7.2"],"schemaVersion":1,"symbols":["Req.get!","Req"]},"contractCommand":["mix","test","--no-deps-check","test/contract.exs"],"environment":{"arch":"x64","ecosystem":"hex","executionContext":"elixir","language":"elixir","os":"linux","packageManager":"mix","runtime":"elixir","schemaVersion":1},"license":"MIT-0","packages":["pkg:hex/req@0.7.2"],"schemaVersion":1,"symbols":["Req.get!","Req"],"verifierAdapter":"hex@1"}
mix.exs
defmodule ReqContract.MixProject do
  use Mix.Project

  def project do
    [
      app: :req_contract,
      version: "0.1.0",
      elixir: "~> 1.15",
      deps: [{:req, "== 0.7.2"}],
      test_paths: ["test"]
    ]
  end

  def application do
    [extra_applications: [:logger]]
  end
end
mix.lock
%{
  "finch": {:hex, :finch, "0.23.0", "e3f9287ac25a8832f848b144c2b57346aac65b205e2e0629a52adfe6507fd837", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.8", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "80e58d3f936f57e3fdf404f83a3642897ae6d9fb642934e46da4d8fe761b99d5"},
  "hpax": {:hex, :hpax, "1.0.4", "777de5d433b0fbdc7c418159c8055910faa8047ffdb3d6b31098d2a46cd7685c", [:mix], [], "hexpm", "afc7cb142ebcc2d01ce7816190b98ce5dd49e799111b24249f3443d730f377ca"},
  "jason": {:hex, :jason, "1.4.5", "2e3a008590b0b8d7388c20293e9dcc9cf3e5d642fd2a114e4cbbb52e595d940a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b0c823996102bcd0239b3c2444eb00409b72f6a140c1950bc8b457d836b30684"},
  "mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"},
  "mint": {:hex, :mint, "1.9.3", "3337184d69179695c7a9f1714d92c11e629d36c8c037a21cf490131d3d150554", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "5f7c9342480c069dbbc4eeac3490303c9e01870ff01a7f1d29b6107054fc1e74"},
  "nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
  "nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
  "req": {:hex, :req, "0.7.2", "364eae2e5f5c984f2dac6d71c07f8c8c89ce0bc49c4d746dacb7a306823020de", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:finch, "~> 0.21", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "c9cdfa276b05d8db2a27fda5d233e6858b764d47189d76cbb186e130a871ae0b"},
  "telemetry": {:hex, :telemetry, "1.4.2", "a0cb522801dffb1c49fe6e30561badffc7b6d0e180db1300df759faa22062855", [:rebar3], [], "hexpm", "928f6495066506077862c0d1646609eed891a4326bee3126ba54b60af61febb1"},
}
test/contract.exs
ExUnit.start()

defmodule ContractTest do
  use ExUnit.Case, async: false

  test "curly placeholders are not interpolated with default path params style" do
    response =
      Req.get!(
        "https://example.com/items/{id}",
        path_params: [id: "1"],
        adapter: fn request ->
          {
            request,
            Req.Response.new(status: 200, body: request.url.path)
          }
        end
      )

    assert response.body != "/items/1"
  end

  test "curly placeholders interpolate when path_params_style is :curly" do
    response =
      Req.get!(
        "https://example.com/items/{id}",
        path_params: [id: "1"],
        path_params_style: :curly,
        adapter: fn request ->
          {
            request,
            Req.Response.new(status: 200, body: request.url.path)
          }
        end
      )

    assert response.body == "/items/1"
  end
end
test/test_helper.exs
ExUnit.start()

오리진 시더

csx-seed