excon 0.37.0 → 0.38.0
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.
- checksums.yaml +8 -8
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +5 -5
- data/changelog.txt +8 -0
- data/excon.gemspec +3 -3
- data/lib/excon/connection.rb +1 -1
- data/lib/excon/constants.rb +1 -1
- data/lib/excon/errors.rb +1 -0
- data/lib/excon/middlewares/mock.rb +3 -1
- data/lib/excon/response.rb +8 -2
- data/tests/middlewares/mock_tests.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2Q1NWY3Zjk1ZmMzZTc5ZTFjODAzZGMyZmUwMTljYTkyYTFjNjAxMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjFkNTZhNTlmMGFkN2MwNjJjNDEzZjM2MGYyYjg3OTNhNTM5NjM5Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjE0NGE3NzdiMDA4YTg0NWIyNDMxNGMyMDBiY2I4MDkzZjRjYWU4NzE1Nzhl
|
10
|
+
Yjk5N2YyYjRlYzdlMDBlM2VhYTU1MTQ4OTU5Zjc2YTc4OWY1OWMwMTNjODdm
|
11
|
+
ZDkxZWVhODdiYmVkNzgzMGU2MGY1NjNmMjBhOTQ2MThmNWQzNGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWQ5OTYyMzhlNzMwZWRlMGY1ODUxMWFkZjU0MWQ1MmRiMjUyMGNjMDA1ZjIw
|
14
|
+
ZjI2YTlhNzZiN2Y1ODg4MGFjMTNjNDljMmU5NzFiNmFhNzMyMjk1YTQxMzg0
|
15
|
+
YjdhYWNlZmUwYjI4MTc1ZTU2NDAwNThlMjljODVjMTc1ZjIyNTg=
|
data/CONTRIBUTING.md
CHANGED
@@ -14,7 +14,7 @@ New contributors are always welcome, when it doubt please ask questions. We stri
|
|
14
14
|
|
15
15
|
### Non-Coding
|
16
16
|
|
17
|
-
* Work for
|
17
|
+
* Work for [twitter](http://twitter.com)? I'd love to reclaim the unused [@excon](http://twitter.com/excon) account!
|
18
18
|
* Offer feedback on open [issues](https://github.com/excon/excon/issues).
|
19
19
|
* Write and help edit [documentation](https://github.com/excon/excon.github.com).
|
20
20
|
* Translate [documentation](https://github.com/excon/excon.github.com) in to other languages.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Usable, fast, simple Ruby HTTP 1.1
|
|
4
4
|
|
5
5
|
Excon was designed to be simple, fast and performant. It works great as a general HTTP(s) client and is particularly well suited to usage in API clients.
|
6
6
|
|
7
|
-
[![Build Status](https://secure.travis-ci.org/
|
7
|
+
[![Build Status](https://secure.travis-ci.org/excon/excon.png)](http://travis-ci.org/excon/excon)
|
8
8
|
[![Dependency Status](https://gemnasium.com/geemus/excon.png)](https://gemnasium.com/geemus/excon)
|
9
9
|
[![Gem Version](https://fury-badge.herokuapp.com/rb/excon.png)](http://badge.fury.io/rb/excon)
|
10
10
|
[![Gittip](http://img.shields.io/gittip/geemus.png)](https://www.gittip.com/geemus/)
|
@@ -339,7 +339,7 @@ The #instrument method will be called for each HTTP request, response, retry, an
|
|
339
339
|
|
340
340
|
For debugging purposes you can also use Excon::StandardInstrumentor to output all events to stderr. This can also be specified by setting the `EXCON_DEBUG` ENV var.
|
341
341
|
|
342
|
-
See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's instrumentation_test.rb for more examples of instrumenting excon.
|
342
|
+
See [the documentation for ActiveSupport::Notifications](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) for more detail on using the subscription interface. See excon's [instrumentation_test.rb](https://github.com/excon/excon/blob/master/tests/middlewares/instrumentation_tests.rb) for more examples of instrumenting excon.
|
343
343
|
|
344
344
|
## HTTPS/SSL Issues
|
345
345
|
|
@@ -363,12 +363,12 @@ Either of these should allow you to work around the socket error and continue wi
|
|
363
363
|
|
364
364
|
* [General Documentation](http://excon.io).
|
365
365
|
* Ask specific questions on [Stack Overflow](http://stackoverflow.com/questions/tagged/excon).
|
366
|
-
* Report bugs and discuss potential features in [Github issues](https://github.com/
|
366
|
+
* Report bugs and discuss potential features in [Github issues](https://github.com/excon/excon/issues).
|
367
367
|
|
368
368
|
## Contributing
|
369
369
|
|
370
|
-
Please refer to [CONTRIBUTING.md](https://github.com/
|
370
|
+
Please refer to [CONTRIBUTING.md](https://github.com/excon/excon/blob/master/CONTRIBUTING.md).
|
371
371
|
|
372
372
|
## License
|
373
373
|
|
374
|
-
Please refer to [LICENSE.md](https://github.com/
|
374
|
+
Please refer to [LICENSE.md](https://github.com/excon/excon/blob/master/LICENSE.md).
|
data/changelog.txt
CHANGED
data/excon.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'excon'
|
16
|
-
s.version = '0.
|
17
|
-
s.date = '2014-
|
16
|
+
s.version = '0.38.0'
|
17
|
+
s.date = '2014-07-09'
|
18
18
|
s.rubyforge_project = 'excon'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
## a custom homepage, consider using your GitHub URL or the like.
|
28
28
|
s.authors = ["dpiddy (Dan Peterson)", "geemus (Wesley Beary)", "nextmat (Matt Sanders)"]
|
29
29
|
s.email = 'geemus@gmail.com'
|
30
|
-
s.homepage = 'https://github.com/
|
30
|
+
s.homepage = 'https://github.com/excon/excon'
|
31
31
|
s.license = 'MIT'
|
32
32
|
|
33
33
|
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
data/lib/excon/connection.rb
CHANGED
data/lib/excon/constants.rb
CHANGED
data/lib/excon/errors.rb
CHANGED
@@ -4,7 +4,7 @@ module Excon
|
|
4
4
|
def request_call(datum)
|
5
5
|
if datum[:mock]
|
6
6
|
# convert File/Tempfile body to string before matching:
|
7
|
-
|
7
|
+
if datum[:body].respond_to?(:read)
|
8
8
|
if datum[:body].respond_to?(:binmode)
|
9
9
|
datum[:body].binmode
|
10
10
|
end
|
@@ -12,6 +12,8 @@ module Excon
|
|
12
12
|
datum[:body].rewind
|
13
13
|
end
|
14
14
|
datum[:body] = datum[:body].read
|
15
|
+
elsif !datum[:body].nil? && !datum[:body].is_a?(String)
|
16
|
+
raise Excon::Errors::InvalidStub.new("Request body should be a string or an IO object. #{datum[:body].class} provided")
|
15
17
|
end
|
16
18
|
|
17
19
|
if stub = Excon.stub_for(datum)
|
data/lib/excon/response.rb
CHANGED
@@ -83,7 +83,10 @@ module Excon
|
|
83
83
|
chunk_size -= chunk.bytesize
|
84
84
|
response_block.call(chunk, nil, nil)
|
85
85
|
end
|
86
|
-
|
86
|
+
new_line_size = 2 # 2 == "\r\n".length
|
87
|
+
while new_line_size > 0
|
88
|
+
new_line_size -= socket.read(new_line_size).length
|
89
|
+
end
|
87
90
|
end
|
88
91
|
else
|
89
92
|
while (chunk_size = socket.readline.chomp!.to_i(16)) > 0
|
@@ -92,7 +95,10 @@ module Excon
|
|
92
95
|
chunk_size -= chunk.bytesize
|
93
96
|
datum[:response][:body] << chunk
|
94
97
|
end
|
95
|
-
|
98
|
+
new_line_size = 2 # 2 == "\r\n".length
|
99
|
+
while new_line_size > 0
|
100
|
+
new_line_size -= socket.read(new_line_size).length
|
101
|
+
end
|
96
102
|
end
|
97
103
|
end
|
98
104
|
parse_headers(socket, datum) # merge trailers into headers
|
@@ -132,6 +132,12 @@ Shindo.tests('Excon stubs') do
|
|
132
132
|
|
133
133
|
end
|
134
134
|
|
135
|
+
tests("invalid stub response").raises(Excon::Errors::InvalidStub) do
|
136
|
+
Excon.stub({:body => 42, :method => :get}, {:status => 200})
|
137
|
+
connection = Excon.new('http://127.0.0.1:9292', :mock => true)
|
138
|
+
connection.request(:body => 42, :method => :get, :path => '/').status
|
139
|
+
end
|
140
|
+
|
135
141
|
tests("mismatched stub").raises(Excon::Errors::StubNotFound) do
|
136
142
|
Excon.stub({:method => :post}, {:body => 'body'})
|
137
143
|
Excon.get('http://127.0.0.1:9292/', :mock => true)
|
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.
|
4
|
+
version: 0.38.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dpiddy (Dan Peterson)
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -224,7 +224,7 @@ files:
|
|
224
224
|
- tests/thread_safety_tests.rb
|
225
225
|
- tests/timeout_tests.rb
|
226
226
|
- tests/utils_tests.rb
|
227
|
-
homepage: https://github.com/
|
227
|
+
homepage: https://github.com/excon/excon
|
228
228
|
licenses:
|
229
229
|
- MIT
|
230
230
|
metadata: {}
|