protocol-http 0.37.0 → 0.38.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 077e5dedb752c1fcbaf9cd4385815019bb17b9bf6d1e47943b39f90dc5d09025
4
- data.tar.gz: 543a8f7b47ea5216d5753e97f90d02a787b21e38613ba431119f648cf7571694
3
+ metadata.gz: 95fdcce85b20ee97e54b44068d59f689f040d1c9489b0e2ff8f9e63464d4c7cd
4
+ data.tar.gz: a72f51087a046f2f713208baace1631414e32b1e2eceb82ff69d479b2c2a7eac
5
5
  SHA512:
6
- metadata.gz: bd1b08154595e4d417e3121bd7e7d0da704de64c54228da39a82c875dc19c1c06924cc8eb43ed710086bf9a2c2c404e79fe7191c360f23fa671c85ac4d995b64
7
- data.tar.gz: 38700f2f25e04f633afdae9146ce3e135631618dd9dee9acf79953bdfad5487f7f7915cadc3c0d65f77aba646a6b68c80f33457f71c34009ffed257b49e4dd3a
6
+ metadata.gz: a4e7504cf962c63a5dac26fbd235b50d6796d5c97eb1f4b40be4cf6023fd1e118a8c64254d1199cab94f1086ad608367e1e4932de1836d63986b2548149fb3b7
7
+ data.tar.gz: b88389e903b175e65fa9f1ee2e36b4894d0484475d8f999ab001cf4968c6edbafb1f9a75fbf14f7fad5f1c7d8e2b4b40a55fd2070aa19ac9eb0a4aae785fdbec
checksums.yaml.gz.sig CHANGED
Binary file
@@ -52,6 +52,13 @@ module Protocol
52
52
 
53
53
  attr :chunks
54
54
 
55
+ # A rewindable body wraps some other body. Convert it to a buffered body. The buffered body will share the same chunks as the rewindable body.
56
+ #
57
+ # @returns [Buffered] the buffered body.
58
+ def buffered
59
+ self.class.new(@chunks)
60
+ end
61
+
55
62
  def finish
56
63
  self
57
64
  end
@@ -64,7 +71,7 @@ module Protocol
64
71
  end
65
72
 
66
73
  def clear
67
- @chunks.clear
74
+ @chunks = []
68
75
  @length = 0
69
76
  @index = 0
70
77
  end
@@ -11,9 +11,9 @@ module Protocol
11
11
  #
12
12
  # Typically, you'd override `#read` to return chunks of data.
13
13
  #
14
- # I n general, you read chunks of data from a body until it is empty and returns `nil`. Upon reading `nil`, the body is considered consumed and should not be read from again.
14
+ # In general, you read chunks of data from a body until it is empty and returns `nil`. Upon reading `nil`, the body is considered consumed and should not be read from again.
15
15
  #
16
- # Reading can also fail, for example if the body represents a streaming upload, and the connection is lost. In this case, the body will raise some kind of error.
16
+ # Reading can also fail, for example if the body represents a streaming upload, and the connection is lost. In this case, `#read` will raise some kind of error.
17
17
  #
18
18
  # If you don't want to read from a stream, and instead want to close it immediately, you can call `close` on the body. If the body is already completely consumed, `close` will do nothing, but if there is still data to be read, it will cause the underlying stream to be reset (and possibly closed).
19
19
  class Readable
@@ -50,6 +50,15 @@ module Protocol
50
50
  false
51
51
  end
52
52
 
53
+ # Return a buffered representation of this body.
54
+ #
55
+ # This method must return a buffered body if `#rewindable?`.
56
+ #
57
+ # @returns [Buffered | Nil] The buffered body.
58
+ def buffered
59
+ nil
60
+ end
61
+
53
62
  # The total length of the body, if known.
54
63
  # @returns [Integer | Nil] The total length of the body, or `nil` if the length is unknown.
55
64
  def length
@@ -42,6 +42,10 @@ module Protocol
42
42
  @body.ready?
43
43
  end
44
44
 
45
+ def buffered
46
+ @body.buffered
47
+ end
48
+
45
49
  def rewind
46
50
  @body.rewind
47
51
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.37.0"
8
+ VERSION = "0.38.0"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.0
4
+ version: 0.38.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -47,7 +47,7 @@ cert_chain:
47
47
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
48
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
49
  -----END CERTIFICATE-----
50
- date: 2024-09-18 00:00:00.000000000 Z
50
+ date: 2024-10-14 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
metadata.gz.sig CHANGED
Binary file