Module: HTTPartyCurl::Logger::ClassMethods
- Defined in:
- lib/httparty_curl/logger.rb
Overview
Class methods added to the including class.
Constant Summary collapse
- HTTP_METHODS =
List of HTTP methods to override with logging functionality.
%i[get post put patch delete].freeze
Instance Method Summary collapse
-
#to_curl(method, uri, options = {}) ⇒ String
Converts an HTTParty request to a cURL command.
Instance Method Details
#to_curl(method, uri, options = {}) ⇒ String
Converts an HTTParty request to a cURL command.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/httparty_curl/logger.rb', line 36 def to_curl(method, uri, = {}) ||= {} # Prepare the URI and append query parameters if present uri = prepare_uri(uri, [:query]) curl_command = initialize_curl_command(method, uri) # Add proxy settings if available add_proxy_settings(curl_command) # Add headers to the cURL command add_headers(curl_command, [:headers]) # Add authentication to the cURL command add_authentication(curl_command, [:basic_auth], [:digest_auth]) # Add body data to the cURL command add_body_data(curl_command, [:body], [:headers]) curl_command.join(" \\\n") end |