Class: Inspec::Resources::Http::Worker::Remote

Inherits:
Base
  • Object
show all
Defined in:
lib/inspec/resources/http.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#http_method, #opts, #url

Instance Method Summary collapse

Constructor Details

#initialize(inspec, http_method, url, opts) ⇒ Remote

Returns a new instance of Remote.



164
165
166
167
168
169
170
171
172
173
# File 'lib/inspec/resources/http.rb', line 164

def initialize(inspec, http_method, url, opts)
  unless inspec.command("curl").exist?
    raise Inspec::Exceptions::ResourceSkipped,
          "curl is not available on the target machine"
  end

  @ran_curl = false
  @inspec = inspec
  super(http_method, url, opts)
end

Instance Attribute Details

#inspecObject (readonly)

Returns the value of attribute inspec.



162
163
164
# File 'lib/inspec/resources/http.rb', line 162

def inspec
  @inspec
end

Instance Method Details

#bodyObject



180
181
182
183
# File 'lib/inspec/resources/http.rb', line 180

def body
  run_curl
  @body&.strip
end

#response_headersObject



185
186
187
188
# File 'lib/inspec/resources/http.rb', line 185

def response_headers
  run_curl
  @response_headers
end

#statusObject



175
176
177
178
# File 'lib/inspec/resources/http.rb', line 175

def status
  run_curl
  @status
end