http resource: Add fallback to #to_s

This prevents a stack trace from being shown to the user if the `http`
resource is used on an unsupported platform.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
Jerry Aldrich 2019-02-27 23:24:30 -08:00 committed by Clinton Wolfe
parent 55ab0ead32
commit af5d6e9285

View file

@ -63,7 +63,11 @@ module Inspec::Resources
end
def to_s
"http #{http_method} on #{@url}"
if @opts and @url
"HTTP #{http_method} on #{@url}"
else
'HTTP Resource'
end
end
class Worker