Method: Compliance::HTTP.post_with_headers

Defined in:
lib/bundles/inspec-compliance/http.rb

.post_with_headers(url, headers, body, insecure) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/bundles/inspec-compliance/http.rb', line 37

def self.post_with_headers(url, headers, body, insecure)
  uri = _parse_url(url)
  req = Net::HTTP::Post.new(uri.path)
  req.body = body unless body.nil?
  headers&.each do |key, value|
    req.add_field(key, value)
  end
  send_request(uri, req, insecure)
end