Class: RspecApiDocumentation::RequestSaver

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/rspec_api_documentation/http_test_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, client) ⇒ RequestSaver

Returns a new instance of RequestSaver.



13
14
15
16
# File 'lib/rspec_api_documentation/http_test_client.rb', line 13

def initialize(app, client)
  super(app)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/rspec_api_documentation/http_test_client.rb', line 11

def client
  @client
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/rspec_api_documentation/http_test_client.rb', line 18

def call(env)
  client.last_request = env

  @app.call(env).on_complete do |env|
    client.last_response = env
  end
end