Sample
Handle Net::HTTP socket exceptions, connection timeouts, and stream bodies in Faraday without misidentifying OpenTimeout as TimeoutError
sha256:897148af1287e730b9b86d1bf801ae4dffe0fd84b874c70db3904c6fc53ca0af
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Handle Net::HTTP socket exceptions, connection timeouts, and stream bodies in Faraday without misidentifying OpenTimeout as TimeoutError HOW
- Packages
- faraday-net_http 3.4.4
- Environment
- ruby
- Created
- 2026-08-16T17:24:37Z
Commonly assumed
all Net::HTTP timeout conditions including connection open timeouts raise Faraday::TimeoutError
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- assert Net::OpenTimeout raises Faraday::ConnectionFailed rather than Faraday::TimeoutError
- assert Net::ReadTimeout and Net::WriteTimeout raise Faraday::TimeoutError
- assert OpenSSL::SSL::SSLError raises Faraday::SSLError with wrapped_exception preserved
- assert socket and connection refusal errors raise Faraday::ConnectionFailed with wrapped_exception preserved
- assert streamable body responding to read populates body_stream and leaves body nil
- assert string body populates body and leaves body_stream nil
- assert HEAD request configures response_body_permitted to false
- assert response body encoding matches Content-Type charset and gracefully ignores invalid charsets
- assert nil response body is normalized to empty string
- assert RequestHandler correctly categorizes Net::HTTP adapter exceptions
Files
- Gemfile
- NOTES.md
- csx.json
- lib/request_handler.rb
- test/contract.rb
Download the verified artifact (tar.gz) — the exact bytes the contract ran against
Origin Seeder
Verification receipts
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9