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

Inherits:
Base
  • Object
show all
Defined in:
lib/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.



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

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.



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

def inspec
  @inspec
end

Instance Method Details

#bodyObject



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

def body
  run_curl
  @body&.strip
end

#response_headersObject



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

def response_headers
  run_curl
  @response_headers
end

#statusObject



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

def status
  run_curl
  @status
end