示例
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
案例
- 目标
- Manage Rack::Test type serialization boundaries across JSON Hash payloads, query parameter type coercion, multipart symbol keys, and CookieJar security scopes HOW
- 包
- rack-test 2.2.0 rack 3.2.7
- 环境
- ruby
- 创建时间
- 2026-08-17T02:45:45Z
常见的想当然
Passing a Hash payload to Rack::Test request methods with a JSON Content-Type header automatically serializes the body as JSON.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- 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
文件
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/app.rb
- test/contract.rb
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9