Class: EventMachine::HttpTest::Request
- Inherits:
-
Object
- Object
- EventMachine::HttpTest::Request
- Defined in:
- lib/em-http-test/test-request.rb
Overview
Base test request object that contains the test data
Instance Method Summary collapse
-
#initialize(type, url, options = {}) ⇒ Request
constructor
A new instance of Request.
- #toRequest ⇒ Object
Constructor Details
#initialize(type, url, options = {}) ⇒ Request
Returns a new instance of Request.
12 13 14 15 16 17 18 19 20 |
# File 'lib/em-http-test/test-request.rb', line 12 def initialize(type, url, = {}) @type = type @url = url @options = if @type == :POST and !@options[:query].nil? @options[:body] = @options[:query] @options.delete(:query) end end |
Instance Method Details
#toRequest ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/em-http-test/test-request.rb', line 22 def toRequest case @type when :GET EM::HttpRequest.new(@url).get @options when :POST EM::HttpRequest.new(@url).post @options end end |