lib/http_client.rb in kingpin-0.5.1 vs lib/http_client.rb in kingpin-0.6.0
- old
+ new
@@ -1,10 +1,9 @@
class HttpClient
require 'net/http'
require "cgi"
- require "benchmark"
def initialize(protocol, host, port, namespace=nil)
@http = Net::HTTP.new(host, port)
@protocol = protocol
@host = host
@@ -44,10 +43,10 @@
@http.request(request)
end
# redefines the resource path including the namespace
def resource_path(resource)
- @namespace.nil? ? resource : "/" + @namespace + resource
+ @namespace.nil? ? resource : @namespace + resource
end
# rebuild a uri in details, so that another protocol, host, port and GET params can be specified, after Net::HTTP was created
def build_uri(resource, params=nil)
uri = URI.parse(@protocol + "://" + @host + ((@port.nil? || @port != "80") ? ":#{@port}" : ""))