Sha256: f98d840eceb3649121f8605ec4049498f0327dd29887ae65cfa67ec2e7a0e30e
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
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 port @connection.port 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 def query uri.query.nil?? {} : CGI.parse(uri.query) end def body @request.body end def post_params body.nil?? {} : CGI.parse(body) end def params post_params.merge(query) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems