Class: DevSuite::RequestLogger::Extractor::Faraday
- Inherits:
-
Base
- Object
- Utils::Construct::Component::Base
- Base
- DevSuite::RequestLogger::Extractor::Faraday
- Defined in:
- lib/dev_suite/request_logger/extractor/faraday.rb
Constant Summary collapse
- COMPONENT_KEY =
::Faraday::Connection
Instance Method Summary collapse
-
#extract_request(connection, request) ⇒ Object
Extracts the request details from a Faraday request object.
-
#extract_response(_connection, response) ⇒ Object
Extracts the response details from a Faraday response object.
Methods inherited from Utils::Construct::Component::Base
Instance Method Details
#extract_request(connection, request) ⇒ Object
Extracts the request details from a Faraday request object
12 13 14 15 16 17 18 19 20 |
# File 'lib/dev_suite/request_logger/extractor/faraday.rb', line 12 def extract_request(connection, request) Request.new( method: request.method.to_s.upcase, url: build_url(connection), headers: build_headers_from_request(request), cookies: (request), body: request.body, ) end |
#extract_response(_connection, response) ⇒ Object
Extracts the response details from a Faraday response object
25 26 27 28 29 30 31 32 |
# File 'lib/dev_suite/request_logger/extractor/faraday.rb', line 25 def extract_response(_connection, response) Response.new( status: response.status, message: response.reason_phrase || "", headers: build_headers_from_response(response), body: response.body, ) end |