2009-09-12 22:32:59 -04:00
|
|
|
When /^I set my HTTParty timeout option to (\d+)$/ do |timeout|
|
|
|
|
@request_options[:timeout] = timeout.to_i
|
|
|
|
end
|
|
|
|
|
2014-03-10 11:35:24 -04:00
|
|
|
When /^I set my HTTParty open_timeout option to (\d+)$/ do |timeout|
|
2014-03-13 07:00:32 -04:00
|
|
|
@request_options[:open_timeout] = timeout.to_i
|
2014-03-10 11:35:24 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
When /^I set my HTTParty read_timeout option to (\d+)$/ do |timeout|
|
2014-03-13 07:00:32 -04:00
|
|
|
@request_options[:read_timeout] = timeout.to_i
|
2014-03-10 11:35:24 -04:00
|
|
|
end
|
|
|
|
|
2009-01-28 23:37:10 -05:00
|
|
|
When /I call HTTParty#get with '(.*)'$/ do |url|
|
|
|
|
begin
|
2009-09-12 22:32:59 -04:00
|
|
|
@response_from_httparty = HTTParty.get("http://#{@host_and_port}#{url}", @request_options)
|
|
|
|
rescue HTTParty::RedirectionTooDeep, Timeout::Error => e
|
2009-01-28 23:37:10 -05:00
|
|
|
@exception_from_httparty = e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-08-05 14:17:52 -04:00
|
|
|
When /^I call HTTParty#head with '(.*)'$/ do |url|
|
|
|
|
begin
|
|
|
|
@response_from_httparty = HTTParty.head("http://#{@host_and_port}#{url}", @request_options)
|
|
|
|
rescue HTTParty::RedirectionTooDeep, Timeout::Error => e
|
|
|
|
@exception_from_httparty = e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-01-28 23:37:10 -05:00
|
|
|
When /I call HTTParty#get with '(.*)' and a basic_auth hash:/ do |url, auth_table|
|
|
|
|
h = auth_table.hashes.first
|
|
|
|
@response_from_httparty = HTTParty.get(
|
|
|
|
"http://#{@host_and_port}#{url}",
|
2014-05-15 16:45:32 -04:00
|
|
|
basic_auth: { username: h["username"], password: h["password"] }
|
2009-01-28 23:37:10 -05:00
|
|
|
)
|
|
|
|
end
|
2010-04-26 21:32:30 -04:00
|
|
|
|
|
|
|
When /I call HTTParty#get with '(.*)' and a digest_auth hash:/ do |url, auth_table|
|
|
|
|
h = auth_table.hashes.first
|
|
|
|
@response_from_httparty = HTTParty.get(
|
|
|
|
"http://#{@host_and_port}#{url}",
|
2014-05-15 16:45:32 -04:00
|
|
|
digest_auth: { username: h["username"], password: h["password"] }
|
2010-04-26 21:32:30 -04:00
|
|
|
)
|
2013-08-05 14:17:52 -04:00
|
|
|
end
|