Module: Typhoeus::Request::Stubbable Private

Included in:
Typhoeus::Request
Defined in:
lib/typhoeus/request/stubbable.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 stubbing on the request side. It plays well with the block_connection configuration, which raises when you make a request which is not stubbed.

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#runResponse

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.

Override run in order to check for matching expectations. When an expectation is found, super is not called. Instead a canned response is assigned to the request.

Examples:

Run the request.

request.run

Since:

  • 0.5.0


19
20
21
22
23
24
25
26
27
# File 'lib/typhoeus/request/stubbable.rb', line 19

def run
  if response = Expectation.response_for(self)
    execute_headers_callbacks(response)
    self.on_body.each{ |callback| callback.call(response.body, response) }
    finish(response)
  else
    super
  end
end