class RequestCurlFormatter

Public Instance Methods

begin_section(_) click to toggle source
# File lib/dtracer/request_formatters.rb, line 38
def begin_section(_)
  ["curl"]
end
body_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 62
def body_section(hash)
  return nil unless hash["body"]

  ["-d #{hash["body"]}"]
end
header_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 50
def header_section(hash)
  return nil unless hash["headers"]

  hash["headers"].map { |key, value| "-H '#{key}: #{value}'" }
end
joining_string() click to toggle source
# File lib/dtracer/request_formatters.rb, line 34
def joining_string
  " \\ \n"
end
method_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 42
def method_section(hash)
  ["-X #{hash["method"]}"]
end
url_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 46
def url_section(hash)
  ["\"#{hash["url"]}\""]
end