Static Methodvapor 4.114.1Vapor
default
Creates a ContentConfiguration
containing all of Vapor’s default coders.
static func `default`() -> ContentConfiguration
Creates a ContentConfiguration
containing all of Vapor’s default coders.
static func `default`() -> ContentConfiguration
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.
init()
Create a new, empty ContentConfiguration
.
static var global: ContentConfiguration { get set }
func requireDecoder(for mediaType: HTTPMediaType) throws -> ContentDecoder
Returns a ContentDecoder
for the specified HTTPMediaType
or throws an error.
func requireEncoder(for mediaType: HTTPMediaType) throws -> ContentEncoder
Returns an ContentEncoder
for the specified HTTPMediaType
or throws an error.
func requireURLDecoder() throws -> URLQueryDecoder
Returns a URLQueryDecoder
or throws an error.
func requireURLEncoder() throws -> URLQueryEncoder
Returns a URLQueryEncoder
or throws an error.
mutating func use(decoder: ContentDecoder, for mediaType: HTTPMediaType)
Adds a ContentDecoder
for the specified HTTPMediaType
.
mutating func use(encoder: ContentEncoder, for mediaType: HTTPMediaType)
Adds a ContentEncoder
for the specified HTTPMediaType
.
mutating func use(urlDecoder: URLQueryDecoder)
mutating func use(urlEncoder: URLQueryEncoder)