Method: Typhoeus::Expectation.response_for

Defined in:
lib/typhoeus/expectation.rb

.response_for(request) ⇒ Typhoeus::Response

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 stubbed response matching the provided request.

Examples:

Find response

Typhoeus::Expectation.response_for(request)

Returns:

  • (Typhoeus::Response)

    The stubbed response from a matching expectation, or nil if no matching expectation is found.

Since:

  • 0.5.0



85
86
87
88
89
90
# File 'lib/typhoeus/expectation.rb', line 85

def response_for(request)
  expectation = find_by(request)
  return nil if expectation.nil?

  expectation.response(request)
end