Class: HTTPalooza::Players::CurbPlayer

Inherits:
Base
  • Object
show all
Defined in:
lib/httpalooza/players/curb.rb

Instance Attribute Summary

Attributes inherited from Base

#request

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

#responseObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/httpalooza/players/curb.rb', line 6

def response
  easy = Curl::Easy.new(request.url.to_s)
  easy.headers = request.headers.to_hash
  easy.nosignal = true

  if [:post, :put].include?(request.method)
    easy.post_body = request.payload
  end

  easy.http(request.method.to_s.upcase)
  Response.new(easy.response_code, easy.body_str)
end