# File lib/webmock/http_lib_adapters/net_http.rb, line 173 173: def self.check_right_http_connection 174: @was_right_http_connection_loaded = defined?(RightHttpConnection) 175: end
# File lib/webmock/http_lib_adapters/net_http.rb, line 177 177: def self.puts_warning_for_right_http_if_needed 178: if !@was_right_http_connection_loaded && defined?(RightHttpConnection) 179: $stderr.puts "\nWarning: RightHttpConnection has to be required before WebMock is required !!!\n" 180: end 181: end
# File lib/webmock/http_lib_adapters/net_http.rb, line 137 137: def self.request_signature_from_request(net_http, request, body = nil) 138: protocol = net_http.use_ssl? ? "https" : "http" 139: 140: path = request.path 141: path = WebMock::Util::URI.heuristic_parse(request.path).request_uri if request.path =~ /^http/ 142: 143: if request["authorization"] =~ /^Basic / 144: userinfo = WebMock::Util::Headers.decode_userinfo_from_header(request["authorization"]) 145: userinfo = WebMock::Util::URI.encode_unsafe_chars_in_userinfo(userinfo) + "@" 146: else 147: userinfo = "" 148: end 149: 150: uri = "#{protocol}://#{userinfo}#{net_http.address}:#{net_http.port}#{path}" 151: method = request.method.downcase.to_sym 152: 153: headers = Hash[*request.to_hash.map {|k,v| [k, v]}.inject([]) {|r,x| r + x}] 154: 155: headers.reject! {|k,v| k =~ /[Aa]uthorization/ && v.first =~ /^Basic / } #we added it to url userinfo 156: 157: 158: if request.body_stream 159: body = request.body_stream.read 160: request.body_stream = nil 161: end 162: 163: if body != nil && body.respond_to?(:read) 164: request.set_body_internal body.read 165: else 166: request.set_body_internal body 167: end 168: 169: WebMock::RequestSignature.new(method, uri, :body => request.body, :headers => headers) 170: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.