excon 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of excon might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{excon}
8
- s.version = "0.0.12"
8
+ s.version = "0.0.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Wesley Beary"]
@@ -51,15 +51,17 @@ unless Excon.mocking?
51
51
  end
52
52
 
53
53
  unless params[:method] == 'HEAD'
54
- if !params[:block] || (params[:expects] && ![*params[:expects]].include?(response.status))
54
+ block = if !params[:block] || (params[:expects] && ![*params[:expects]].include?(response.status))
55
55
  response.body = ''
56
- params[:block] = lambda { |chunk| response.body << chunk }
56
+ lambda { |chunk| response.body << chunk }
57
+ else
58
+ params[:block]
57
59
  end
58
60
 
59
61
  if response.headers['Content-Length']
60
62
  remaining = response.headers['Content-Length'].to_i
61
63
  while remaining > 0
62
- params[:block].call(connection.read([CHUNK_SIZE, remaining].min))
64
+ block.call(connection.read([CHUNK_SIZE, remaining].min))
63
65
  remaining -= CHUNK_SIZE
64
66
  end
65
67
  elsif response.headers['Transfer-Encoding'] == 'chunked'
@@ -67,13 +69,13 @@ unless Excon.mocking?
67
69
  chunk_size = connection.readline.chop!.to_i(16)
68
70
  chunk = connection.read(chunk_size + 2).chop! # 2 == "/r/n".length
69
71
  if chunk_size > 0
70
- params[:block].call(chunk)
72
+ block.call(chunk)
71
73
  else
72
74
  break
73
75
  end
74
76
  end
75
77
  elsif response.headers['Connection'] == 'close'
76
- params[:block].call(connection.read)
78
+ block.call(connection.read)
77
79
  Thread.current[:_excon_connection] = nil
78
80
  end
79
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wesley Beary