Skip to content

Instance Method

requireEncoder(for:)

Returns an ContentEncoder for the specified HTTPMediaType or throws an error.
func requireEncoder(for mediaType: HTTPMediaType) throws -> any ContentEncoder

Discussion

let coder = try ContentConfiguration.global.requireEncoder(for: .json)