Exemplo
Manage Rack::Test type serialization boundaries across JSON Hash payloads, query parameter type coercion, multipart symbol keys, and CookieJar security scopes
sha256:5fe3699ec9450e25104ae03ae89602c44a28ffdbdf87748819f7f3de86bdc4bc
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Manage Rack::Test type serialization boundaries across JSON Hash payloads, query parameter type coercion, multipart symbol keys, and CookieJar security scopes HOW
- Pacotes
- rack-test 2.2.0 rack 3.2.7
- Ambiente
- ruby
- Criado
- 2026-08-17T02:45:45Z
O que costuma-se supor
Passing a Hash payload to Rack::Test request methods with a JSON Content-Type header automatically serializes the body as JSON.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- assert posting a Hash with application/json Content-Type sends a form-urlencoded query string and fails JSON parsing unless explicitly passed as a serialized JSON string
- assert primitive Hash parameter types are coerced to strings, nil is preserved as nil, empty arrays mutate to an array containing an empty string, and empty hashes are omitted from params
- assert URI query string and params Hash merge overwrites scalar keys but appends array elements together
- assert UploadedFile triggers multipart encoding with symbol-keyed descriptor hashes while unwrapped IO objects are stringified into urlencoded form data
- assert CookieJar silently ignores Secure cookies received over plain HTTP, filters Secure cookies from HTTP requests, and scopes non-domain cookies to the exact host
Arquivos
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/app.rb
- test/contract.rb
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9