Instance Method
encode(_:to:headers:userInfo:)
“Encode object” method. The provided encodable object’s contents must be stored in the provided
NIOCore/ByteBuffer, and any appropriate headers for the type of the content may be stored in the provided HTTPHeaders objects. The provided userInfo dictionary must be forwarded to the underlying Swift/Encoder used to perform the encoding operation.func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders, userInfo: [CodingUserInfoKey : any Sendable]) throws where E : Encodable
Discussion
For legacy API compatibility reasons, the default protocol conformance for this method forwards it to the legacy encode method.
Default Implementations
ContentEncoder Implementations
encode(_:to:headers:userInfo:)“Encode object” method. The provided encodable object’s contents must be stored in the providedNIOCore/ByteBuffer, and any appropriate headers for the type of the content may be stored in the providedHTTPHeadersobjects. The provideduserInfodictionary must be forwarded to the underlyingSwift/Encoderused to perform the encoding operation.