dagger 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dagger.rb +3 -2
- data/lib/dagger/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3bc4ac0c7a26be19d201c2533adaa387ff98966
|
4
|
+
data.tar.gz: 568d6876931061e4543b25b0759d075f08ef2e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46f03bb607d5a69bacd7150b1b2f718fcbea5f9debb54959751d63f05addce4ba28923b233e37876cd0b16ebe601615fb5e6607b8634fc8be9b91818aa8289d1
|
7
|
+
data.tar.gz: f853c20e31090f96e3ea4f6906a91d7565c395ce5e67be094b6b84ae516e82dfc4a8a9d2a32caecb69c89ccddf688a26d1cacfec99b39c69b3b163574095feed
|
data/lib/dagger.rb
CHANGED
@@ -8,6 +8,7 @@ require 'base64'
|
|
8
8
|
|
9
9
|
module Dagger
|
10
10
|
|
11
|
+
REDIRECT_CODES = [301, 302, 303].freeze
|
11
12
|
DEFAULT_HEADERS = {
|
12
13
|
'Accept' => '*/*',
|
13
14
|
'User-Agent' => "Dagger/#{VERSION} (Ruby Net::HTTP Wrapper, like curl)"
|
@@ -17,7 +18,7 @@ module Dagger
|
|
17
18
|
opts[:follow] = 10 if opts[:follow] == true
|
18
19
|
|
19
20
|
uri = parse_uri(uri)
|
20
|
-
uri.query = encode(
|
21
|
+
uri.query = encode(query) if query
|
21
22
|
http = client(uri, opts)
|
22
23
|
request = Net::HTTP::Get.new(uri.request_uri, DEFAULT_HEADERS.merge(opts[:headers] || {}))
|
23
24
|
|
@@ -27,7 +28,7 @@ module Dagger
|
|
27
28
|
|
28
29
|
resp, data = http.request(request)
|
29
30
|
|
30
|
-
if
|
31
|
+
if REDIRECT_CODES.include?(resp.code.to_i) && resp['Location'] && (opts[:follow] && opts[:follow] > 0)
|
31
32
|
opts[:follow] -= 1
|
32
33
|
return get(resp['Location'], nil, opts)
|
33
34
|
end
|
data/lib/dagger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|