Sha256: 69d7add5f4ae10b132458c2a56e17aa9a2032283667d4a615c425a7819a59667

Contents?: true

Size: 467 Bytes

Versions: 6

Compression:

Stored size: 467 Bytes

Contents

module Excon
  module Middleware
    class Expects < Excon::Middleware::Base
      def response_call(datum)
        if datum.has_key?(:expects) && ![*datum[:expects]].include?(datum[:response][:status])
          raise(
            Excon::Errors.status_error(
              datum.reject {|key,value| key == :response},
              datum[:response]
            )
          )
        else
          @stack.response_call(datum)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
excon-0.18.5 lib/excon/middlewares/expects.rb
excon-0.18.4 lib/excon/middlewares/expects.rb
excon-0.18.3 lib/excon/middlewares/expects.rb
excon-0.18.2 lib/excon/middlewares/expects.rb
excon-0.18.1 lib/excon/middlewares/expects.rb
excon-0.18.0 lib/excon/middlewares/expects.rb