@@ -91,7 +91,6 @@ extension HTTPClientRequest.Body {
91
91
self . init ( . byteBuffer( byteBuffer) )
92
92
}
93
93
94
- #if swift(>=5.6)
95
94
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `RandomAccessCollection` of bytes.
96
95
///
97
96
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -106,21 +105,6 @@ extension HTTPClientRequest.Body {
106
105
) -> Self where Bytes. Element == UInt8 {
107
106
Self . _bytes ( bytes)
108
107
}
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
124
108
125
109
@inlinable
126
110
static func _bytes< Bytes: RandomAccessCollection > (
@@ -139,7 +123,6 @@ extension HTTPClientRequest.Body {
139
123
} )
140
124
}
141
125
142
- #if swift(>=5.6)
143
126
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Sequence` of bytes.
144
127
///
145
128
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -165,32 +148,6 @@ extension HTTPClientRequest.Body {
165
148
) -> Self where Bytes. Element == UInt8 {
166
149
Self . _bytes ( bytes, length: length)
167
150
}
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
194
151
195
152
@inlinable
196
153
static func _bytes< Bytes: Sequence > (
@@ -210,7 +167,6 @@ extension HTTPClientRequest.Body {
210
167
} )
211
168
}
212
169
213
- #if swift(>=5.6)
214
170
/// Create an ``HTTPClientRequest/Body-swift.struct`` from a `Collection` of bytes.
215
171
///
216
172
/// This construction will flatten the bytes into a `ByteBuffer`. As a result, the peak memory
@@ -232,28 +188,6 @@ extension HTTPClientRequest.Body {
232
188
) -> Self where Bytes. Element == UInt8 {
233
189
Self . _bytes ( bytes, length: length)
234
190
}
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
257
191
258
192
@inlinable
259
193
static func _bytes< Bytes: Collection > (
@@ -273,7 +207,6 @@ extension HTTPClientRequest.Body {
273
207
} )
274
208
}
275
209
276
- #if swift(>=5.6)
277
210
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of `ByteBuffer`s.
278
211
///
279
212
/// This construction will stream the upload one `ByteBuffer` at a time.
@@ -293,26 +226,6 @@ extension HTTPClientRequest.Body {
293
226
) -> Self where SequenceOfBytes. Element == ByteBuffer {
294
227
Self . _stream ( sequenceOfBytes, length: length)
295
228
}
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
316
229
317
230
@inlinable
318
231
static func _stream< SequenceOfBytes: AsyncSequence > (
@@ -328,7 +241,6 @@ extension HTTPClientRequest.Body {
328
241
return body
329
242
}
330
243
331
- #if swift(>=5.6)
332
244
/// Create an ``HTTPClientRequest/Body-swift.struct`` from an `AsyncSequence` of bytes.
333
245
///
334
246
/// This construction will consume 1kB chunks from the `Bytes` and send them at once. This optimizes for
@@ -350,28 +262,6 @@ extension HTTPClientRequest.Body {
350
262
) -> Self where Bytes. Element == UInt8 {
351
263
Self . _stream ( bytes, length: length)
352
264
}
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
375
265
376
266
@inlinable
377
267
static func _stream< Bytes: AsyncSequence > (
0 commit comments