Class: HTTPalooza::Players::CurlPlayer
- Defined in:
- lib/httpalooza/players/curl.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
execute!, #initialize, introducing!, #name
Constructor Details
This class inherits a constructor from HTTPalooza::Players::Base
Instance Method Details
#response ⇒ Object
6 7 8 9 10 11 |
# File 'lib/httpalooza/players/curl.rb', line 6 def response output = `curl -isX #{request.method.to_s.upcase} '#{request.url}'` code = output.scan(/^HTTP[^\s]*\s(\d+)/).first.first.to_i rescue 0 body = output.split(/^\s$/, 2).last.try(:strip) Response.new(code, body) end |