You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/05/07 17:38:13 UTC

svn commit: r654151 - in /incubator/buildr/trunk: lib/buildr/core/transports.rb spec/transport_spec.rb

Author: assaf
Date: Wed May  7 08:38:11 2008
New Revision: 654151

URL: http://svn.apache.org/viewvc?rev=654151&view=rev
Log:
Merge branch 'BUILDR-67'

Modified:
    incubator/buildr/trunk/lib/buildr/core/transports.rb
    incubator/buildr/trunk/spec/transport_spec.rb

Modified: incubator/buildr/trunk/lib/buildr/core/transports.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/transports.rb?rev=654151&r1=654150&r2=654151&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/transports.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/transports.rb Wed May  7 08:38:11 2008
@@ -299,7 +299,7 @@
       http.use_ssl = true if self.instance_of? URI::HTTPS
 
       puts "Requesting #{self}"  if Buildr.application.options.trace
-      request = Net::HTTP::Get.new(path.empty? ? '/' : path, headers)
+      request = Net::HTTP::Get.new(request_uri.empty? ? '/' : request_uri, headers)
       request.basic_auth self.user, self.password if self.user
       http.request request do |response|
         case response

Modified: incubator/buildr/trunk/spec/transport_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/transport_spec.rb?rev=654151&r1=654150&r2=654151&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/transport_spec.rb (original)
+++ incubator/buildr/trunk/spec/transport_spec.rb Wed May  7 08:38:11 2008
@@ -221,7 +221,9 @@
     @proxy = 'http://john:smith@myproxy:8080'
     @domain = 'domain'
     @host_domain = "host.#{@domain}"
-    @uri = URI("http://#{@host_domain}")
+    @path = "/foo/bar/baz"
+    @query = "?query"
+    @uri = URI("http://#{@host_domain}#{@path}#{@query}")
     @no_proxy_args = [@host_domain, 80]
     @proxy_args = @no_proxy_args + ['myproxy', 8080, 'john', 'smith']
     @http = mock('http')
@@ -297,6 +299,14 @@
     request.should_receive(:basic_auth).with('john', 'secret')
     URI("http://john:secret@#{@host_domain}").read
   end
+
+  it 'should include the query part when performing HTTP GET' do
+    # should this test be generalized or shared with any other URI subtypes?
+    Net::HTTP.stub!(:new).and_return(@http)
+    Net::HTTP::Get.should_receive(:new).with(/#{Regexp.escape(@query)}$/, nil)
+    @uri.read
+  end
+
 end