Sha256: e6e9afc1c2a609e0cb967f816eb5483c4ba66ec0c33ba88643a471d344ae9828
Contents?: true
Size: 603 Bytes
Versions: 6
Compression:
Stored size: 603 Bytes
Contents
# Adds support to retrying a request if the result is 503. # # To use it, load it in your dsl: # Restfulie.at("http://localhost:3000/product/2").retry_when_unavailable.get module Restfulie::Client::Feature class RetryWhenUnavailable def execute(chain, request, env) resp = chain.continue(request, env) if should_retry?(resp, env) resp = chain.continue(request, env) end resp end protected # extension point that allows you to redefine # when a request should be retried def should_retry?(response, env) response.code == 503 end end end
Version data entries
6 entries across 6 versions & 2 rubygems