Module: Verikloak::HTTP
- Defined in:
- lib/verikloak/http.rb
Overview
Internal HTTP helpers shared across components.
Constant Summary collapse
- DEFAULT_TIMEOUT =
Default request timeout (seconds) for outbound discovery/JWKs calls.
5
- DEFAULT_OPEN_TIMEOUT =
Default open/read timeout (seconds) before establishing the HTTP connection.
2
- RETRY_OPTIONS =
Retry middleware configuration used for idempotent GET requests. Retries on 429/5xx with exponential backoff and jitter.
{ max: 2, interval: 0.1, interval_randomness: 0.2, backoff_factor: 2, methods: %i[get], retry_statuses: [429, 500, 502, 503, 504] }.freeze
Class Method Summary collapse
-
.default_connection ⇒ Faraday::Connection
Builds a Faraday connection with conservative defaults suitable for network-bound operations (discovery and JWKs fetching).
Class Method Details
.default_connection ⇒ Faraday::Connection
Builds a Faraday connection with conservative defaults suitable for network-bound operations (discovery and JWKs fetching).
29 30 31 32 33 34 35 36 |
# File 'lib/verikloak/http.rb', line 29 def self.default_connection Faraday.new do |f| f.request :retry, RETRY_OPTIONS f..timeout = DEFAULT_TIMEOUT f..open_timeout = DEFAULT_OPEN_TIMEOUT f.adapter Faraday.default_adapter end end |