Class: EventMachine::HttpTest::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/em-http-test/test-request.rb

Overview

Base test request object that contains the test data

Instance Method Summary collapse

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, options = {})
	@type = type
	@url = url
	@options = options
	if @type == :POST and !@options[:query].nil?
		@options[:body] = @options[:query]
		@options.delete(:query)
	end
end

Instance Method Details

#toRequestObject



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