1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00

Validate that proc passed to add_before_exec...

Previously, you could call RestClient.add_before_execution_proc() with
no arguments or block, and it would add `nil` to the list of procs. This
would cause a nil NoMethodError down the line. Instead, immediately
raise an ArgumentError.
This commit is contained in:
Andy Brody 2015-06-09 23:53:09 -07:00
parent dd9769365c
commit a2dbe2c474

View file

@ -166,6 +166,7 @@ module RestClient
# Add a Proc to be called before each request in executed.
# The proc parameters will be the http request and the request params.
def self.add_before_execution_proc &proc
raise ArgumentError.new('block is required') unless proc
@@before_execution_procs << proc
end