Class: DevSuite::RequestBuilder::Tool::Curl

Inherits:
Base show all
Defined in:
lib/dev_suite/request_builder/tool/curl.rb

Instance Method Summary collapse

Methods inherited from Utils::Construct::Component::Base

component_key

Instance Method Details

#build_command(http_method:, url:, headers:, body: nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dev_suite/request_builder/tool/curl.rb', line 7

def build_command(http_method:, url:, headers:, body: nil)
  validate_parameters(http_method, url, headers, body)

  command = build_base_command(http_method, url)

  add_headers(command, headers)
  add_body(command, body)
  add_insecure_option(command)
  add_verbose_option(command)
  add_follow_redirects_option(command)
  add_cookie_option(command)
  add_user_agent_option(command)
  add_max_time_option(command)
  add_connect_timeout_option(command)

  command.join(" ").strip
end