Sha256: db359cc10a428dc9980ccafccce507b607ce51bc72d61b9b1b9d56e0a01a3429

Contents?: true

Size: 835 Bytes

Versions: 6909

Compression:

Stored size: 835 Bytes

Contents

module Typhoeus
  class Hydra

    # This module handles stubbing on the hydra 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 add in order to check for matching expecations.
      # When an expecation is found, super is not called. Instead a
      # canned response is assigned to the request.
      #
      # @example Add the request.
      #   hydra.add(request)
      def add(request)
        if response = Expectation.response_for(request)
          request.execute_headers_callbacks(response)
          request.on_body.each{ |callback| callback.call(response.body, response) }
          request.finish(response)
        else
          super
        end
      end
    end
  end
end

Version data entries

6,909 entries across 6,906 versions & 28 rubygems

Version Path
ory-client-0.0.1.alpha111 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha110 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha109 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
avalara_sdk-2.4.26 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha108 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-oathkeeper-client-0.38.23.beta1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-oathkeeper-client-0.38.22.beta1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha107 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-hydra-client-1.11.7 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha106 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-hydra-client-1.11.6 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-keto-client-0.8.0.alpha1 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha105 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha104 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha103 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-hydra-client-1.11.5 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
cloudsmith-api-1.30.0 vendor/bundle/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha101 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-client-0.0.1.alpha100 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb
ory-hydra-client-1.11.4 vendor/bundle/ruby/2.5.0/gems/typhoeus-1.4.0/lib/typhoeus/hydra/stubbable.rb