ContentEncoder
Conform a type to this protocol to make it usable for encoding data via Vapor’s ContentConfiguration
system.
protocol ContentEncoder : Sendable
Browse conforming typesConform a type to this protocol to make it usable for encoding data via Vapor’s ContentConfiguration
system.
protocol ContentEncoder : Sendable
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct ContentConfiguration
Configures which Encoder
s and Decoder
s to use when interacting with data in HTTP messages.
protocol Sendable
func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders) throws where E : Encodable
Legacy “encode object” method. The provided encodable object’s contents must be stored in the provided ByteBuffer
, and any appropriate headers for the type of the content may be stored in the provided HTTPHeaders
.
func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders, userInfo: [CodingUserInfoKey : Sendable]) throws where E : Encodable
“Encode object” method. The provided encodable object’s contents must be stored in the provided 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 Encoder
used to perform the encoding operation.
func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders, userInfo: [CodingUserInfoKey : Sendable]) throws where E : Encodable