Sha256: f15ea1e8991f617e238eed5e6cb840d60131f57c5c326594b4398a30e535c562

Contents?: true

Size: 953 Bytes

Versions: 39

Compression:

Stored size: 953 Bytes

Contents

# encoding: utf-8

module OneApm
  module Support
    module HTTPClients
      class NetHTTPRequest
        def initialize(connection, request)
          @connection = connection
          @request = request
        end

        def type
          'Net::HTTP'
        end

        def host
          if hostname = self['host']
            hostname.split(':').first
          else
            @connection.address
          end
        end

        def method
          @request.method
        end

        def [](key)
          @request[key]
        end

        def []=(key, value)
          @request[key] = value
        end

        def uri
          case @request.path
          when /^https?:\/\//
            URI(@request.path)
          else
            scheme = @connection.use_ssl? ? 'https' : 'http'
            URI("#{scheme}://#{@connection.address}:#{@connection.port}#{@request.path}")
          end
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
oneapm_rpm-1.3.7 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.7.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.6 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.6.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.5 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.5.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.4 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.4.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.3 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.3.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.2 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.2.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.1.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.0 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.3.0.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.2.9 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.2.9.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.2.8 lib/one_apm/support/http_clients/net_http_wrappers.rb
oneapm_rpm-1.2.8.rc1 lib/one_apm/support/http_clients/net_http_wrappers.rb