Class: Excon::Middleware::Expects

Inherits:
Base
  • Object
show all
Defined in:
lib/excon/middlewares/expects.rb

Instance Method Summary collapse

Methods inherited from Base

#error_call, #initialize, #request_call

Constructor Details

This class inherits a constructor from Excon::Middleware::Base

Instance Method Details

#response_call(datum) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/excon/middlewares/expects.rb', line 4

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},
        Excon::Response.new(datum[:response])
      )
    )
  else
    @stack.response_call(datum)
  end
end