async-http-cache 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/http/cache/body.rb +17 -12
- data/lib/async/http/cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a0767f1441dbbd35aaeb13647f55630a876b45a4d88d1a298df0ee4f5fafb6
|
4
|
+
data.tar.gz: dcaba9874a9fc9d784b86969a1f844e67acb11677c19afa70b8dce9d2481169a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9628112d985f1a9fafbcf55d988f8f3aa43185372194685df8b0746366dba14be491a5341773fd94710f349b3f391074d5a6c4ef0a027c805a217b800bc6a8ba
|
7
|
+
data.tar.gz: f5a667a2361eec9e8773599eb743390bca93da29e73109aebf843e6470b9205debb72424df9b00424b4f89b2c57bbbca38820c354a953c028f35414a73edb483
|
@@ -29,18 +29,23 @@ module Async
|
|
29
29
|
module Body
|
30
30
|
def self.wrap(message, &block)
|
31
31
|
if body = message.body
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
if body.empty?
|
33
|
+
# A body that is empty? at the outset, is immutable. This generally only applies to HEAD requests.
|
34
|
+
yield message, body
|
35
|
+
else
|
36
|
+
# Create a rewindable body wrapping the message body:
|
37
|
+
rewindable = ::Protocol::HTTP::Body::Rewindable.new(body)
|
38
|
+
|
39
|
+
# Set the message body to the rewindable body:
|
40
|
+
message.body = rewindable
|
41
|
+
|
42
|
+
# Wrap the message with the callback:
|
43
|
+
::Protocol::HTTP::Body::Streamable.wrap(message) do |error|
|
44
|
+
if error
|
45
|
+
Async.logger.error(self) {error}
|
46
|
+
else
|
47
|
+
yield message, rewindable.buffered
|
48
|
+
end
|
44
49
|
end
|
45
50
|
end
|
46
51
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|