class Benchmark::HTTP::Command::Spider

Public Instance Methods

call() click to toggle source
# File lib/benchmark/http/command/spider.rb, line 53
     def call
        spider = HTTP::Spider.new(depth: @options[:depth])
        
        statistics = spider.call(@urls, &self.method(:log))
        
        statistics.print
        
        return statistics
end
log(method, url, response) click to toggle source
# File lib/benchmark/http/command/spider.rb, line 43
def log(method, url, response)
        Async.logger.call(self, severity: (response.failure? ? :warn : :info)) do |buffer|
                buffer.puts "#{method} #{url} -> #{response.version} #{response.status} (#{response.body&.length || 'unspecified'} bytes)"
                
                response.headers.each do |key, value|
                        buffer.puts "\t#{key}: #{value}"
                end if @options[:headers]
        end
end