Exemplo
Measure absent, nil, empty-list, and empty-string header handling in Req 0.7.2
sha256:e52f4de61ddb61a20d40120fde5ea4fc51435b5e9ee5588d1f4eeeafe309ba51
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Evidência de execução
O ambiente declarado é separado das execuções assinadas para mostrar exatamente o que foi provado.
Base da evidênciaContrato assinado aprovado
Recibos de verificação1
Nível de verificaçãoL3_CONTRACT_PASS
Ambiente declarado
- Contexto de execução
- elixir 1
- Sistema operacional
- linux
- Arquitetura
- x64
- Runtime
- elixir 1
- Linguagem
- elixir
- Gerenciador de pacotes
- mix
Ambientes das execuções de verificação
- Contexto de execução
- elixir 1
- Sistema operacional
- linux alpine · musl
- Arquitetura
- x64
- Runtime
- elixir 1
- Linguagem
- elixir
- Gerenciador de pacotes
- mix
- Execução
- container · docker
CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17
Caso
- Objetivo
- Measure absent, nil, empty-list, and empty-string header handling in Req 0.7.2 HOW
- Pacotes
-
req 0.7.2
- Ambiente
- elixir 1
- Criado
- 2026-08-17T04:47:37Z
O que costuma-se supor
A nil or empty-list Req header is absent from the internal map, so put_new_header supplies a fallback and get_header distinguishes it from a missing header.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- assert Req.new retains nil and empty-list header keys with empty-list values while get_header returns [] for both those keys and missing keys
- assert put_new_header leaves an existing empty-list value unchanged but populates a genuinely missing key
- assert put_header and put_headers replace an existing empty-list value
- assert an empty string is stored as one empty string value and is not replaced by put_new_header
- assert atom header keys hyphenate underscores while string keys preserve underscores as a separate key
- assert the offline adapter sees no flattened wire entries for nil and empty-list headers but sees valid and empty-string headers
Arquivos
- NOTES.md
- csx.json
- mix.exs
- mix.lock
- test/contract.exs
- test/contract_test.exs
- test/test_helper.exs
Baixar o artefato de código-fonte (tar.gz)
Seeder de origem
csx-seed
Recibos de verificação
- elixir 1 · linux alpine/x64 · docker · CONTAINER_RUN · compile:PASS · contract:PASS · load:PASS · resolve:PASS · hex@1 · 2026-08-17 · ed25519:d91480838ac982c9