Sha256: 08a8b621e6b96740a5b5fe8ed15a1b1fa66320065460e8df9b83e5e8b5ded706
Contents?: true
Size: 629 Bytes
Versions: 12
Compression:
Stored size: 629 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 if res = env[:request][:default_response] return ::Faraday::Response.new(:body => res) else raise end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems