faraday-net_http_persistent 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: 6b05db120e4bfe54ba8aac6765a61332ec277fec5ef9b51329adee5b9f59bb0f
4
- data.tar.gz: cdc170d7512ff9abe24ef22da6fccc9847a400464fab5cefe62b5e67db36c2c2
3
+ metadata.gz: f1bc1f8930b55722004909277859a02d2b792fb7efdd09381a852c06085eeb7f
4
+ data.tar.gz: 7ad77ee2a562d6479e57c361366ab3753e5f32e179839c00bff89232dce4d3f8
5
5
  SHA512:
6
- metadata.gz: 48155794e2df01a3920d67e7d0b4a07c5992be88d51dfa76fc7d83a75d20bc44710f8c583523e65fc7ea6f27edd949848a8880d9c87b826ed90df9b07ba0d344
7
- data.tar.gz: 9c38ab8831b88851c36efcc839e170ea2e62612a1d6f70cd669b36e282fd38241f553a1839046c5522d85fc4eb810b316a35e94aec7a02975f504356331fe668
6
+ metadata.gz: 62fd182c8b193d450544f3d655b87f01a552fe6845e3f67094b1d0f5b94904713ed0f11ea185af40a7bd170c4cef69adad69e1cf4982e7a5b2eedb23de7e12bf
7
+ data.tar.gz: d6c37fe53505c0bf528b4451b9494d4265f2e37e23e38967e18c7c65d92b5c6c9bbc8fe9c2a8606e555a356085b543750f8c72449e9344acb3feebbb903a7d78
data/README.md CHANGED
@@ -62,9 +62,9 @@ The gem is available as open source under the terms of the [MIT License][mit-lic
62
62
 
63
63
  This project is intended to be a safe, welcoming space for collaboration.
64
64
  Everyone interacting in the Faraday::Http project’s codebases, issue trackers,
65
- chat rooms and mailing lists is expected to follow the [code of conduct].
65
+ chat rooms and mailing lists is expected to follow the [code of conduct][code-of-conduct].
66
66
 
67
- [code-of-conduct]: https://github.com/lostisland/faraday-http/blob/master/.github/CODE_OF_CONDUCT.md
67
+ [code-of-conduct]: https://github.com/lostisland/faraday-http/blob/main/CODE_OF_CONDUCT.md
68
68
  [covenant]: http://contributor-covenant.org
69
69
  [faraday]: https://github.com/lostisland/faraday
70
70
  [faraday-website]: https://lostisland.github.io/faraday
@@ -50,7 +50,26 @@ module Faraday
50
50
  end
51
51
 
52
52
  def perform_request(http, env)
53
- http.request env[:url], create_request(env)
53
+ if env[:request].stream_response?
54
+ size = 0
55
+ yielded = false
56
+
57
+ http_response = http.request(env[:url], create_request(env)) do |response|
58
+ response.read_body do |chunk|
59
+ if chunk.bytesize.positive? || size.positive?
60
+ yielded = true
61
+ size += chunk.bytesize
62
+ env[:request].on_data.call(chunk, size)
63
+ end
64
+ end
65
+ end
66
+
67
+ env[:request].on_data.call(+"", 0) unless yielded
68
+ http_response.body = nil
69
+ http_response
70
+ else
71
+ http.request(env[:url], create_request(env))
72
+ end
54
73
  rescue Errno::ETIMEDOUT, Net::OpenTimeout => e
55
74
  raise Faraday::TimeoutError, e
56
75
  rescue Net::HTTP::Persistent::Error => e
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module NetHttpPersistent
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-net_http_persistent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Rogers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2021-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http-persistent