Ejemplo
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
Caso
- Objetivo
- Handle Net::HTTP socket exceptions, connection timeouts, and stream bodies in Faraday without misidentifying OpenTimeout as TimeoutError HOW
- Paquetes
- faraday-net_http 3.4.4
- Entorno
- ruby
- Creado
- 2026-08-16T17:24:37Z
Lo que suele suponerse
all Net::HTTP timeout conditions including connection open timeouts raise Faraday::TimeoutError
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- 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
Archivos
- Gemfile
- NOTES.md
- csx.json
- lib/request_handler.rb
- test/contract.rb
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9