Class: Couch::Request

Inherits:
HTTPkit::Request
  • Object
show all
Defined in:
lib/couch/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_method, uri, headers = {}, body = nil) ⇒ Request

Returns a new instance of Request


5
6
7
8
9
10
11
12
13
# File 'lib/couch/request.rb', line 5

def initialize(http_method, uri, headers = {}, body = nil)
  body &&= begin
    headers['Content-Type'] = 'application/json'
    JSON.generate(body)
  end

  headers['Accept'] = 'application/json'
  super(http_method, uri, headers, body || '')
end