Method: HTTP::Client#perform
- Defined in:
- lib/http/client.rb
#perform(req, options) ⇒ Object
Perform a single (no follow) HTTP request
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/http/client.rb', line 64 def perform(req, ) verify_connection!(req.uri) @state = :dirty begin @connection ||= HTTP::Connection.new(req, ) unless @connection.failed_proxy_connect? @connection.send_request(req) @connection.read_headers! end rescue Error => e .features.each_value do |feature| feature.on_error(req, e) end raise end res = build_response(req, ) res = .features.inject(res) do |response, (_name, feature)| feature.wrap_response(response) end @connection.finish_response if req.verb == :head @state = :clean res rescue close raise end |