Beispiel
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
Fall
- Ziel
- Handle Net::HTTP socket exceptions, connection timeouts, and stream bodies in Faraday without misidentifying OpenTimeout as TimeoutError HOW
- Pakete
- faraday-net_http 3.4.4
- Umgebung
- ruby
- Erstellt
- 2026-08-16T17:24:37Z
Häufige Annahme
all Net::HTTP timeout conditions including connection open timeouts raise Faraday::TimeoutError
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
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
Dateien
- Gemfile
- NOTES.md
- csx.json
- lib/request_handler.rb
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9