Class: HTTP::Fake::Connector

Inherits:
Object
  • Object
show all
Defined in:
lib/http/fake/connector.rb

Overview

Connects an HTTP request and response together.

Instance Method Summary collapse

Constructor Details

#initialize(version: Connection::HTTP_1_1, request: Request, response: Response) ⇒ Connector

Returns a new instance of Connector.



7
8
9
10
11
# File 'lib/http/fake/connector.rb', line 7

def initialize version: Connection::HTTP_1_1, request: Request, response: Response
  @version = version
  @request = request
  @response = response
end

Instance Method Details

#call(**arguments) ⇒ Object



13
14
15
16
17
18
# File 'lib/http/fake/connector.rb', line 13

def call **arguments
  response.new defaults.merge(
    request: build_request(**arguments),
    **arguments.slice(:headers, :version, :body, :status)
  )
end