Module: Typhoeus::Hydra::BlockConnection Private

Included in:
Typhoeus::Hydra
Defined in:
lib/typhoeus/hydra/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 hydra 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.

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#add(request) ⇒ 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 add in order to check before if block connection is turned on. If thats the case a NoStub error is raised.

Examples:

Add the request.

hydra.add(request)

Parameters:

  • request (Request)

    The request to enqueue.

Since:

  • 0.5.0



26
27
28
29
30
31
32
# File 'lib/typhoeus/hydra/block_connection.rb', line 26

def add(request)
  if request.blocked?
    raise Typhoeus::Errors::NoStub.new(request)
  else
    super
  end
end