Class: Elastictastic::Middleware::JsonDecodeResponse

Inherits:
Base
  • Object
show all
Defined in:
lib/elastictastic/middleware.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from TransportMethods

#delete, #get, #head, #post, #put

Constructor Details

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

Instance Method Details

#request(method, path, body = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/elastictastic/middleware.rb', line 39

def request(method, path, body = nil)
  response = super
  if response.body.present?
    Adapter::Response.new(
      response.status,
      response.headers,
      Elastictastic.json_decode(response.body)
    )
  else
    response
  end
end