Class: Rectory::Request
- Inherits:
-
Object
- Object
- Rectory::Request
- Includes:
- Celluloid
- Defined in:
- lib/rectory/request.rb
Overview
Test the expectated results of an HTTP request
Instance Method Summary collapse
-
#perform(expectation) ⇒ Rectory::Expectation
Test the expectated results of an HTTP request.
Instance Method Details
#perform(expectation) ⇒ Rectory::Expectation
Test the expectated results of an HTTP request
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rectory/request.rb', line 15 def perform(expectation) uri = URI expectation.url req = Net::HTTP::Get.new uri.request_uri res = Net::HTTP.start(uri.hostname, uri.port) do |http| http.request req end expectation.result[:location] = res['location'] expectation.result[:code] = res.code.to_i return expectation end |