Sha256: 4e2a259a81871ab4d0676cfee07a7607e5bd85dba044f7152acca9ac3a6673ef

Contents?: true

Size: 854 Bytes

Versions: 6802

Compression:

Stored size: 854 Bytes

Contents

module Typhoeus
  class Request

    # 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.
    #
    # @api private
    module Stubbable

      # 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.
      #
      # @example Run the request.
      #   request.run
      #
      # @return [ Response ] The response.
      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
    end
  end
end

Version data entries

6,802 entries across 6,799 versions & 27 rubygems

Version Path
cloudsmith-api-0.49.9 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.1/lib/typhoeus/request/stubbable.rb
cloudsmith-api-0.44.4 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.1/lib/typhoeus/request/stubbable.rb
dadapush_client-1.0.1 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/stubbable.rb
approveapi-1.0.8 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/stubbable.rb
approveapi-1.0.5 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.3.1/lib/typhoeus/request/stubbable.rb
typhoeus-1.3.1 lib/typhoeus/request/stubbable.rb
cloudsmith-api-0.30.7 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/stubbable.rb
color_me_shop-1.0.0 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.3.0/lib/typhoeus/request/stubbable.rb
cloudsmith-api-0.21.4 vendor/bundle/ruby/2.3.0/gems/typhoeus-1.3.0/lib/typhoeus/request/stubbable.rb
typhoeus-1.3.0 lib/typhoeus/request/stubbable.rb
typhoeus-1.1.2 lib/typhoeus/request/stubbable.rb
typhoeus-1.1.1 lib/typhoeus/request/stubbable.rb
typhoeus-1.1.0 lib/typhoeus/request/stubbable.rb
typhoeus-1.0.2 lib/typhoeus/request/stubbable.rb
typhoeus-1.0.1 lib/typhoeus/request/stubbable.rb
typhoeus-1.0.0 lib/typhoeus/request/stubbable.rb
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/typhoeus-0.8.0/lib/typhoeus/request/stubbable.rb
typhoeus-0.8.0 lib/typhoeus/request/stubbable.rb
typhoeus-0.7.3 lib/typhoeus/request/stubbable.rb
typhoeus-0.7.2 lib/typhoeus/request/stubbable.rb