Repository: buildr
Updated Branches:
  refs/heads/master 56fbfa527 -> a3fcaf022


BUILDR-719 Change User-Agent when uploading artifacts


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/a3fcaf02
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/a3fcaf02
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/a3fcaf02

Branch: refs/heads/master
Commit: a3fcaf022497f70bb42abbe420d53e1d3fd72b58
Parents: 56fbfa5
Author: Antoine Toulme <[email protected]>
Authored: Sun Nov 20 20:59:45 2016 -0800
Committer: Antoine Toulme <[email protected]>
Committed: Sun Nov 20 21:00:43 2016 -0800

----------------------------------------------------------------------
 CHANGELOG                     | 2 ++
 lib/buildr/core/transports.rb | 2 +-
 spec/core/transport_spec.rb   | 8 ++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/a3fcaf02/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index c539f03..0039135 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,8 @@
 * Fixed:  BUILDR-728 Snapshots metadata incorrectly created
 * Fixed:  BUILDR-718 Deprecate SVN repository - remove links to SVN
 * Change: BUILDR-724 Use scalamain to call scala projects
+* Change: Update json_pure to 2.0.2
+* Change: BUILDR-719 Change User-Agent when uploading artifacts
 
 1.5.0 (2016-09-23)
 * Change: Update RJB to 1.5.4

http://git-wip-us.apache.org/repos/asf/buildr/blob/a3fcaf02/lib/buildr/core/transports.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/core/transports.rb b/lib/buildr/core/transports.rb
index bf62ef3..7d6d7fa 100644
--- a/lib/buildr/core/transports.rb
+++ b/lib/buildr/core/transports.rb
@@ -332,7 +332,7 @@ module URI
         while chunk = yield(RW_CHUNK_SIZE)
           content << chunk
         end
-        headers = { 'Content-MD5'=>Digest::MD5.hexdigest(content.string), 
'Content-Type'=>'application/octet-stream' }
+        headers = { 'Content-MD5'=>Digest::MD5.hexdigest(content.string), 
'Content-Type'=>'application/octet-stream', 
'User-Agent'=>"Buildr-#{Buildr::VERSION}" }
         request = Net::HTTP::Put.new(request_uri.empty? ? '/' : request_uri, 
headers)
         request.basic_auth self.user, self.password if self.user
         response = nil

http://git-wip-us.apache.org/repos/asf/buildr/blob/a3fcaf02/spec/core/transport_spec.rb
----------------------------------------------------------------------
diff --git a/spec/core/transport_spec.rb b/spec/core/transport_spec.rb
index 5843bfb..88fc434 100644
--- a/spec/core/transport_spec.rb
+++ b/spec/core/transport_spec.rb
@@ -420,6 +420,14 @@ describe URI::HTTP, '#write' do
     end
     @uri.write @content
   end
+  
+  it 'should set User-Agent header' do
+    @http.should_receive(:request) do |request|
+      request['User-Agent'].should == "Buildr-#{Buildr::VERSION}"
+      Net::HTTPOK.new(nil, nil, nil)
+    end
+    @uri.write @content
+  end
 
   it 'should send entire content' do
     @http.should_receive(:request) do |request|

Reply via email to