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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8c2144cb2fc6feb4333d118265b8b33d31df3e2
4
- data.tar.gz: 3615c376cd385f9731dd7fe022f4dfa56e2b95e9
3
+ metadata.gz: c3bc4ac0c7a26be19d201c2533adaa387ff98966
4
+ data.tar.gz: 568d6876931061e4543b25b0759d075f08ef2e72
5
5
  SHA512:
6
- metadata.gz: 223372582af34f07018cbc0df565b543c57a5b47c6e876081bf9dc0b98b4d402e71ada2abd1aa77772ca31321add90ed71880b73e07e75d13c98c649adb73094
7
- data.tar.gz: 7b9a7983be101326ab8ba00a810f416c1e225fe9960c335c9c544ba616168f5777ef9cb8026f7b28811c1e0434e1dccbf03bf36e7d4bd847ecc8be7920a27b65
6
+ metadata.gz: 46f03bb607d5a69bacd7150b1b2f718fcbea5f9debb54959751d63f05addce4ba28923b233e37876cd0b16ebe601615fb5e6607b8634fc8be9b91818aa8289d1
7
+ data.tar.gz: f853c20e31090f96e3ea4f6906a91d7565c395ce5e67be094b6b84ae516e82dfc4a8a9d2a32caecb69c89ccddf688a26d1cacfec99b39c69b3b163574095feed
@@ -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(opts[:query]) if opts[:query]
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 [301,302].include?(resp.code.to_i) && resp['Location'] && (opts[:follow] && opts[:follow] > 0)
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
@@ -1,6 +1,6 @@
1
1
  module Dagger
2
2
  MAJOR = 0
3
- MINOR = 2
3
+ MINOR = 3
4
4
  PATCH = 0
5
5
 
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
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.2.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-19 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler