Module: Typhoeus::Request::BlockConnection Private
- Included in:
- Typhoeus::Request
- Defined in:
- lib/typhoeus/request/block_connection.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module handles the blocked connection request mode on the request side, where only stubbed requests are allowed. Connection blocking needs to be turned on:
Typhoeus.configure do |config|
config.block_connection = true
end
When trying to do real requests a NoStub error is raised.
Instance Method Summary collapse
-
#blocked? ⇒ Boolean
private
Returns wether a request is blocked or not.
-
#run ⇒ Object
private
Overrides run in order to check before if block connection is turned on.
Instance Method Details
#blocked? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns wether a request is blocked or not. Takes request.block_connection and Typhoeus::Config.block_connection into consideration.
43 44 45 46 47 48 49 |
# File 'lib/typhoeus/request/block_connection.rb', line 43 def blocked? if block_connection.nil? Typhoeus::Config.block_connection else block_connection end end |
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Overrides run in order to check before if block connection is turned on. If thats the case a NoStub error is raised.
27 28 29 30 31 32 33 |
# File 'lib/typhoeus/request/block_connection.rb', line 27 def run if blocked? raise Typhoeus::Errors::NoStub.new(self) else super end end |