Class: Elastictastic::Middleware::JsonEncodeBody

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



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/elastictastic/middleware.rb', line 23

def request(method, path, body = nil)
  case body
  when String, nil
    super
  else
    @connection.request(
      method, path,
      Elastictastic.json_encode(body)
    )
  end
end