@@ -91,7 +91,6 @@ extension HTTPClientRequest.Body {
9191 self . init ( . byteBuffer( byteBuffer) )
9292 }
9393
94- #if swift(>=5.6)
9594 /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `RandomAccessCollection` of bytes.
9695 ///
9796 /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -106,21 +105,6 @@ extension HTTPClientRequest.Body {
106105 ) -> Self where Bytes. Element == UInt8 {
107106 Self . _bytes ( bytes)
108107 }
109- #else
110- /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `RandomAccessCollection` of bytes.
111- ///
112- /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
113- /// usage of this construction will be double the size of the original collection. The construction
114- /// of the `ByteBuffer` will be delayed until it's needed.
115- ///
116- /// - parameter bytes: The bytes of the request body.
117- @inlinable
118- public static func bytes< Bytes: RandomAccessCollection > (
119- _ bytes: Bytes
120- ) -> Self where Bytes. Element == UInt8 {
121- Self . _bytes ( bytes)
122- }
123- #endif
124108
125109 @inlinable
126110 static func _bytes< Bytes: RandomAccessCollection > (
@@ -139,7 +123,6 @@ extension HTTPClientRequest.Body {
139123 } )
140124 }
141125
142- #if swift(>=5.6)
143126 /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Sequence` of bytes.
144127 ///
145128 /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -165,32 +148,6 @@ extension HTTPClientRequest.Body {
165148 ) -> Self where Bytes. Element == UInt8 {
166149 Self . _bytes ( bytes, length: length)
167150 }
168- #else
169- /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Sequence` of bytes.
170- ///
171- /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
172- /// usage of this construction will be double the size of the original collection. The construction
173- /// of the `ByteBuffer` will be delayed until it's needed.
174- ///
175- /// Unlike ``bytes(_:)-1uns7``, this construction does not assume that the body can be replayed. As a result,
176- /// if a redirect is encountered that would need us to replay the request body, the redirect will instead
177- /// not be followed. Prefer ``bytes(_:)-1uns7`` wherever possible.
178- ///
179- /// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
180- /// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
181- /// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
182- ///
183- /// - parameters:
184- /// - bytes: The bytes of the request body.
185- /// - length: The length of the request body.
186- @inlinable
187- public static func bytes< Bytes: Sequence > (
188- _ bytes: Bytes ,
189- length: Length
190- ) -> Self where Bytes. Element == UInt8 {
191- Self . _bytes ( bytes, length: length)
192- }
193- #endif
194151
195152 @inlinable
196153 static func _bytes< Bytes: Sequence > (
@@ -210,7 +167,6 @@ extension HTTPClientRequest.Body {
210167 } )
211168 }
212169
213- #if swift(>=5.6)
214170 /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Collection` of bytes.
215171 ///
216172 /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -232,28 +188,6 @@ extension HTTPClientRequest.Body {
232188 ) -> Self where Bytes. Element == UInt8 {
233189 Self . _bytes ( bytes, length: length)
234190 }
235- #else
236- /// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Collection` of bytes.
237- ///
238- /// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
239- /// usage of this construction will be double the size of the original collection. The construction
240- /// of the `ByteBuffer` will be delayed until it's needed.
241- ///
242- /// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
243- /// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
244- /// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
245- ///
246- /// - parameters:
247- /// - bytes: The bytes of the request body.
248- /// - length: The length of the request body.
249- @inlinable
250- public static func bytes< Bytes: Collection > (
251- _ bytes: Bytes ,
252- length: Length
253- ) -> Self where Bytes. Element == UInt8 {
254- Self . _bytes ( bytes, length: length)
255- }
256- #endif
257191
258192 @inlinable
259193 static func _bytes< Bytes: Collection > (
@@ -273,7 +207,6 @@ extension HTTPClientRequest.Body {
273207 } )
274208 }
275209
276- #if swift(>=5.6)
277210 /// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of `ByteBuffer`s.
278211 ///
279212 /// This construction will stream the upload one `ByteBuffer` at a time.
@@ -293,26 +226,6 @@ extension HTTPClientRequest.Body {
293226 ) -> Self where SequenceOfBytes. Element == ByteBuffer {
294227 Self . _stream ( sequenceOfBytes, length: length)
295228 }
296- #else
297- /// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of `ByteBuffer`s.
298- ///
299- /// This construction will stream the upload one `ByteBuffer` at a time.
300- ///
301- /// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
302- /// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
303- /// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
304- ///
305- /// - parameters:
306- /// - sequenceOfBytes: The bytes of the request body.
307- /// - length: The length of the request body.
308- @inlinable
309- public static func stream< SequenceOfBytes: AsyncSequence > (
310- _ sequenceOfBytes: SequenceOfBytes ,
311- length: Length
312- ) -> Self where SequenceOfBytes. Element == ByteBuffer {
313- Self . _stream ( sequenceOfBytes, length: length)
314- }
315- #endif
316229
317230 @inlinable
318231 static func _stream< SequenceOfBytes: AsyncSequence > (
@@ -328,7 +241,6 @@ extension HTTPClientRequest.Body {
328241 return body
329242 }
330243
331- #if swift(>=5.6)
332244 /// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of bytes.
333245 ///
334246 /// This construction will consume 1kB chunks from the `Bytes` and send them at once. This optimizes for
@@ -350,28 +262,6 @@ extension HTTPClientRequest.Body {
350262 ) -> Self where Bytes. Element == UInt8 {
351263 Self . _stream ( bytes, length: length)
352264 }
353- #else
354- /// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of bytes.
355- ///
356- /// This construction will consume 1kB chunks from the `Bytes` and send them at once. This optimizes for
357- /// `AsyncSequence`s where larger chunks are buffered up and available without actually suspending, such
358- /// as those provided by `FileHandle`.
359- ///
360- /// Caution should be taken with this method to ensure that the `length` is correct. Incorrect lengths
361- /// will cause unnecessary runtime failures. Setting `length` to ``Length/unknown`` will trigger the upload
362- /// to use `chunked` `Transfer-Encoding`, while using ``Length/known(_:)`` will use `Content-Length`.
363- ///
364- /// - parameters:
365- /// - bytes: The bytes of the request body.
366- /// - length: The length of the request body.
367- @inlinable
368- public static func stream< Bytes: AsyncSequence > (
369- _ bytes: Bytes ,
370- length: Length
371- ) -> Self where Bytes. Element == UInt8 {
372- Self . _stream ( bytes, length: length)
373- }
374- #endif
375265
376266 @inlinable
377267 static func _stream< Bytes: AsyncSequence > (
0 commit comments