Sha256: 47924289819e3da7eb7042cb884048f58c4e4e352e35a035fe1c7356722f2c7a
Contents?: true
Size: 642 Bytes
Versions: 13
Compression:
Stored size: 642 Bytes
Contents
require 'faraday' module Saddle module Middleware module Response # Public: Returns a default response in the case of an exception # Expects default_response to be defined in the request of connection options, otherwise rethrows exception class DefaultResponse < Faraday::Middleware def call(env) begin @app.call(env) rescue Faraday::Error::ClientError if res = env[:request][:default_response] return ::Faraday::Response.new(:body => res) else raise end end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems