Sha256: 2ba3cbc322516554a83e1b7538f9d9ab4be3aed52711a7eaaa64bb935acb04e0

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

module WBench
  module Timings
    class AppServer
      def initialize(browser)
        uri = Addressable::URI.parse(browser.url)
        @http = Net::HTTP.new(uri.host, uri.inferred_port)
        @http.use_ssl = uri.scheme == 'https'

        @request = Net::HTTP::Get.new(uri.request_uri)
      end

      def result
        response = @http.request(@request)

        unless response.header['x-runtime'].nil?
          (response.header['x-runtime'].to_f*1000).to_i
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wbench-0.3.7 lib/wbench/timings/app_server.rb
wbench-0.3.6 lib/wbench/timings/app_server.rb
wbench-0.3.5 lib/wbench/timings/app_server.rb
wbench-0.3.4 lib/wbench/timings/app_server.rb
wbench-0.3.3 lib/wbench/timings/app_server.rb
wbench-0.3.2 lib/wbench/timings/app_server.rb