protocol-http 0.63.0 → 0.64.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: 12be9d363df2ffd17498996e847c26fd84e807b7602d16592fc12ee27365bf30
4
- data.tar.gz: 9c39629fe635e04e829a831eaf7f886f8c99e267426e55e139bee65a138798b2
3
+ metadata.gz: 144524e37ab8f38f1391e711994fd1880cdce76b35586a757aa5745645ec95ee
4
+ data.tar.gz: 47caea36c05b7ae9bfedde624a614f9cfd4cee7b2471e0f18ccfa3645ed0b8f3
5
5
  SHA512:
6
- metadata.gz: 737b7089fbf76a2a985af0e4f95f1c81d2dda4f86608ef269841e9a1c12c70199612856b8a406627520cd092f85cd9c652351b582cd15d13c81901b2e6a3a419
7
- data.tar.gz: 2c33f92c8cb86b4aad6bd962798aea79741e3389fc2741f4eb27982e659500281a559e25e4e3cec08d0407932da25411fed00f2a993bb76e70182490fe2888be
6
+ metadata.gz: febc1afedb0368e12ec0293525e7221b8d223b9aaf9eb1e6d9987a232e05eef3492933d30ea912534bed0acf09db13e436227a049dd5db405b9f2ca6ccdff209
7
+ data.tar.gz: ed719d0d3d5dadb3ca0698d7fee3b56f0e80c3b6fa83e0b9f2cf05bb3dbe48587204e2ecc829b8404fe8407320fcde9f6a3aee14adf40b6dd62a2913ca60f65e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -153,6 +153,28 @@ module Protocol
153
153
  return false
154
154
  end
155
155
 
156
+ # Rewind the request body so it can be sent again.
157
+ # @returns [Boolean] Whether the request body was rewound.
158
+ def rewind!
159
+ if body = @body
160
+ return body.rewind
161
+ end
162
+
163
+ # Requests without a body can be sent again immediately.
164
+ return true
165
+ end
166
+
167
+ # Prepare the request body to be sent again, if it is safe to retry.
168
+ # @returns [Boolean] Whether the request was prepared for retry.
169
+ def retry!
170
+ # Only idempotent request methods can be retried safely.
171
+ if @method == Methods::POST || @method == Methods::PATCH || @method == Methods::CONNECT
172
+ return false
173
+ end
174
+
175
+ return self.rewind!
176
+ end
177
+
156
178
  # Convert the request to a hash, suitable for serialization.
157
179
  #
158
180
  # @returns [Hash] The request as a hash.
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.63.0"
8
+ VERSION = "0.64.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -30,6 +30,10 @@ Please see the [project documentation](https://socketry.github.io/protocol-http/
30
30
 
31
31
  Please see the [project releases](https://socketry.github.io/protocol-http/releases/index) for all releases.
32
32
 
33
+ ### v0.64.0
34
+
35
+ - Add `Protocol::HTTP::Request#rewind!` and `#retry!` for preparing requests to be sent again.
36
+
33
37
  ### v0.63.0
34
38
 
35
39
  - Add support for the HTTP `QUERY` method.
@@ -75,15 +79,6 @@ Please see the [project releases](https://socketry.github.io/protocol-http/relea
75
79
  - Update `Headers#[]=` to use `coerce(value)` for smart conversion of user input.
76
80
  - Normalization (e.g., lowercasing) is applied by `parse`, `coerce`, and `<<` methods, but not by `new` when given arrays.
77
81
 
78
- ### v0.55.0
79
-
80
- - **Breaking**: Move `Protocol::HTTP::Header::QuotedString` to `Protocol::HTTP::QuotedString` for better reusability.
81
- - **Breaking**: Handle cookie key/value pairs using `QuotedString` as per RFC 6265.
82
- - Don't use URL encoding for cookie key/value.
83
- - **Breaking**: Remove `Protocol::HTTP::URL` and `Protocol::HTTP::Reference` – replaced by `Protocol::URL` gem.
84
- - `Protocol::HTTP::URL` -\> `Protocol::URL::Encoding`.
85
- - `Protocol::HTTP::Reference` -\> `Protocol::URL::Reference`.
86
-
87
82
  ## See Also
88
83
 
89
84
  - [protocol-http1](https://github.com/socketry/protocol-http1) — HTTP/1 client/server implementation using this
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.64.0
4
+
5
+ - Add `Protocol::HTTP::Request#rewind!` and `#retry!` for preparing requests to be sent again.
6
+
3
7
  ## v0.63.0
4
8
 
5
9
  - Add support for the HTTP `QUERY` method.
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.63.0
4
+ version: 0.64.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file