Sha256: decd3a0533c007268d8ab7d48a295df8a0a943760452a7b781675acf57fedc9d
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
# encoding: utf-8 module OneApm module Support module HTTPClients class CurbRequest def initialize( curlobj ) @curlobj = curlobj end def type 'Curb' end def host self["host"] || self["Host"] || self.uri.host end def port self["port"] || self["port"] || self.uri.port end def method @curlobj._oa_http_verb end def []( key ) @curlobj.headers[ key ] end def []=( key, value ) @curlobj.headers[ key ] = value end def uri @uri ||= OneApm::Support::HTTPClients::URIUtil.parse_url(@curlobj.url) end def query @uri.query.nil?? {} : CGI.parse(@uri.query) end def body @curlobj._oa_http_params end def post_params body.nil?? {} : CGI.parse(body) end def params post_params.merge(query) end end class CurbResponse def initialize(curlobj) @headers = {} @curlobj = curlobj end def [](key) @headers[ key.downcase ] end def to_hash @headers.dup end def append_header_data( data ) key, value = data.split( /:\s*/, 2 ) @headers[ key.downcase ] = value @curlobj._oa_header_str ||= '' @curlobj._oa_header_str << data end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems