bytes(_:)

Create an Body from a RandomAccessCollection of bytes.

HTTPClientRequest.swift:125
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
@preconcurrency static func bytes<Bytes>(_ bytes: Bytes) -> HTTPClientRequest.Body where Bytes : RandomAccessCollection, Bytes : Sendable, Bytes.Element == UInt8

Parameters

bytes

The bytes of the request body.

This construction will flatten the bytes into a ByteBuffer in chunks of ~4MB. As a result, the peak memory usage of this construction will be a small multiple of ~4MB. The construction of the ByteBuffer will be delayed until it’s needed.