示例
Handle query string parameter type collisions and exception types in Faraday::NestedParamsEncoder and Faraday error hierarchies
sha256:3689a956358214e59bb0f50e25447a90b64486b545cea81b569a8c7373cc8f45
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Handle query string parameter type collisions and exception types in Faraday::NestedParamsEncoder and Faraday error hierarchies HOW
- 包
- faraday 2.14.3
- 环境
- ruby
- 创建时间
- 2026-08-16T17:18:49Z
常见的想当然
Faraday::NestedParamsEncoder.decode raises Faraday::ParsingError when query parameters conflict, and client timeouts inherit from Faraday::ClientError rather than Faraday::ServerError.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- Faraday::NestedParamsEncoder.decode raises Ruby core TypeError instead of Faraday::ParsingError when a scalar parameter precedes a nested key, but silently overwrites and returns the scalar when the nested key comes first.
- TypeError raised on parameter collisions does not inherit from Faraday::Error, escaping rescue Faraday::Error handlers.
- Faraday::NestedParamsEncoder.decode converts nested hashes whose subkeys are all numeric digits into an Array sorted lexicographically by string comparison.
- Faraday::NestedParamsEncoder.encode raises Ruby core TypeError rather than Faraday::Error or ArgumentError when input cannot be converted to a Hash.
- Faraday::FlatParamsEncoder.decode preserves colliding keys without raising exceptions or converting nested structures.
- Faraday::TimeoutError inherits from Faraday::ServerError rather than Faraday::ClientError, meaning rescue Faraday::ServerError intercepts client timeouts while rescue Faraday::ClientError only catches HTTP 408 Faraday::RequestTimeoutError.
- Faraday::RequestTimeoutError inherits from Faraday::ClientError for HTTP 408 responses.
- Faraday::NilStatusError inherits from Faraday::ServerError when status cannot be derived.
- Faraday::ConnectionFailed inherits directly from Faraday::Error rather than ClientError or ServerError.
- Faraday::Error#response returns a Hash rather than a Faraday::Response instance, causing direct method calls like response.status to raise NoMethodError.
文件
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- test/contract.rb
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9