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.



150
151
152
153
154
155
156
157
158
159
# File 'lib/resources/http.rb', line 150

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.



148
149
150
# File 'lib/resources/http.rb', line 148

def inspec
  @inspec
end

Instance Method Details

#bodyObject



166
167
168
169
# File 'lib/resources/http.rb', line 166

def body
  run_curl
  @body&.strip
end

#response_headersObject



171
172
173
174
# File 'lib/resources/http.rb', line 171

def response_headers
  run_curl
  @response_headers
end

#statusObject



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

def status
  run_curl
  @status
end