lib/bigbench/fragment.rb in bigbench-0.0.5 vs lib/bigbench/fragment.rb in bigbench-0.0.6
- old
+ new
@@ -45,10 +45,11 @@
configure_options
end
# Initiates the request in the context of a <tt>Net::HTTP.start</tt> block
def run!
+ randomize_params
EventMachine::HttpRequest.new(@uri.to_s).send(@method, @request_options)
end
# Adds the current tracking result as a hash to the benchmark's tracker
def track!(start, stop, http)
@@ -67,18 +68,22 @@
)
end
private
+ def randomize_params
+ @request_options[:body] = @options[:params].sample if @options[:params].kind_of?(Array)
+ end
+
def configure_options
# Basic Auth
@request_options[:head] = { 'authorization' => BigBench.config.basic_auth } unless BigBench.config.basic_auth.nil?
@request_options[:head] = { 'authorization' => @options[:basic_auth] } unless @options[:basic_auth].nil?
# Body
@request_options[:body] = @options[:params] unless @options[:params].nil?
-
+ randomize_params
end
end
# Performs a GET request to the given url, e.g.
#
\ No newline at end of file