Module: Cucumber::Http::Request

Defined in:
lib/cucumber/http/world_extensions/request.rb

Instance Method Summary collapse

Instance Method Details

#perform_request(method, path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/cucumber/http/world_extensions/request.rb', line 6

def perform_request(method, path)
  add_header('params', parameters)

  begin
    r = RestClient::Request.execute(
      method: method.downcase,
      url: path,
      headers: headers,
      payload: payload
    )
  rescue RestClient::Exception => e
    r = e.response
  end

  set_response('status', r.code)
  set_response('body', r.body)
  set_response('headers', r.headers)
end