This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new ef7afb5 Return status
ef7afb5 is described below
commit ef7afb58705c20da6109fe2ff120c167c1d11b87
Author: Sebb <[email protected]>
AuthorDate: Fri Jan 14 13:16:47 2022 +0000
Return status
Note: method currently unused, so OK to change API
---
lib/whimsy/asf/git.rb | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/whimsy/asf/git.rb b/lib/whimsy/asf/git.rb
index 2ea8404..92fb6a9 100644
--- a/lib/whimsy/asf/git.rb
+++ b/lib/whimsy/asf/git.rb
@@ -14,11 +14,12 @@ module ASF
GITHUB_HOST = 'raw.githubusercontent.com'
# get a file live from github, e.g. '/apache/petri/master/info.yaml'
- # returns body
- def self.github(file, etag = nil)
+ # returns body, status
+ def self.github(file, _etag = nil)
http = Net::HTTP.new(GITHUB_HOST, 443)
http.use_ssl = true
- return http.request(Net::HTTP::Get.new(file)).body
+ req = http.request(Net::HTTP::Get.new(file))
+ return req.code, req.body
end
# path to <tt>repository.yml</tt> in the source.
@@ -102,5 +103,10 @@ end
if $0 == __FILE__
require 'net/http'
- puts ASF::Git.github('/apache/petri/master/info.yaml')
-end
\ No newline at end of file
+ c, b = ASF::Git.github('/apache/petri/master/info.yaml')
+ p c
+ puts b[0..60]
+ c, b = ASF::Git.github('/apache/petri/master/missing.invalid')
+ p c
+ puts b
+end