pebblebed 0.3.21 → 0.3.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pebblebed/http.rb +8 -1
- data/lib/pebblebed/version.rb +1 -1
- data/spec/generic_client_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d6cc9e91f2cc09da6e335cceeb464b2587e13f6
|
4
|
+
data.tar.gz: 6bdf45e966352b2b75fb9f86c665a578e439e209
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b96f0a8865ddde136b66bc93be02e27cbaaf60b88ddfe9548dfbaf35a19c056387e84b53106897139e0f6d343905b981d0ac4ff47fd41d4783178bbc3f6caaa
|
7
|
+
data.tar.gz: 0d1d0a8376de9876073f8fab97deac8b9ce82959f7a5aae1a42f2d02d924cfddd45ff242cbb6995207387ff82f97e0785818003272fa8cc6a282c96b9ba79156
|
data/lib/pebblebed/http.rb
CHANGED
@@ -174,7 +174,14 @@ module Pebblebed
|
|
174
174
|
|
175
175
|
def self.with_easy(&block)
|
176
176
|
easy = Thread.current[:pebblebed_curb_easy] ||= Curl::Easy.new
|
177
|
-
|
177
|
+
begin
|
178
|
+
easy.reset
|
179
|
+
rescue RuntimeError => e
|
180
|
+
# This can happen if previous streaming isn't finished
|
181
|
+
raise unless e.to_s =~ /^Cannot close an active curl handle within a callback/
|
182
|
+
easy.close rescue nil
|
183
|
+
easy = Thread.current[:pebblebed_curb_easy] = Curl::Easy.new
|
184
|
+
end
|
178
185
|
yield easy
|
179
186
|
end
|
180
187
|
|
data/lib/pebblebed/version.rb
CHANGED
data/spec/generic_client_spec.rb
CHANGED
@@ -150,7 +150,7 @@ describe Pebblebed::GenericClient do
|
|
150
150
|
URI.parse("http://example.org/"),
|
151
151
|
{"session" => "session_key"},
|
152
152
|
anything) { |_, _, options|
|
153
|
-
options[:on_data].call(%{"a"\n\n})
|
153
|
+
options[:on_data].call(%{{"a":42}\n\n})
|
154
154
|
}.and_return(curl_result)
|
155
155
|
|
156
156
|
payloads = []
|
@@ -160,7 +160,7 @@ describe Pebblebed::GenericClient do
|
|
160
160
|
on_data: ->(payload) {
|
161
161
|
payloads << payload
|
162
162
|
})
|
163
|
-
expect(payloads).to eq ['a']
|
163
|
+
expect(payloads).to eq [{'a' => 42}]
|
164
164
|
expect(response.status).to eq 201
|
165
165
|
expect(response.body).to eq "halp"
|
166
166
|
end
|