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:
parent
dd9769365c
commit
a2dbe2c474
1 changed files with 1 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue