Class: HTTPClient

Inherits:
Object
  • Object
show all
Includes:
Rack::Test::Methods
Defined in:
lib/cucumber/json/api/steps.rb

Instance Method Summary collapse

Instance Method Details

#make_request(verb, path, body = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/cucumber/json/api/steps.rb', line 9

def make_request(verb, path, body={})
  params = body.respond_to?(:keys) ? body : nil
  body   = body.respond_to?(:keys) ? nil : body

  env = { method: verb, format: :json }
  env[:input]  = StringIO.new(body.to_json) if body
  env[:params] = params if params

  request(path, env)
end