Vapor Documentation Beta

Structure Plaintext​Encoder

public struct PlaintextEncoder: ContentEncoder

Encodes data as plaintext, utf8.

%3 PlaintextEncoder PlaintextEncoder ContentEncoder ContentEncoder PlaintextEncoder->ContentEncoder

Conforms To

ContentEncoder

Initializers

init(_:​)

public init(_ contentType: HTTPMediaType = .plainText)

Creates a new PlaintextEncoder.

Parameters

content​Type HTTPMedia​Type

Plaintext MediaType to use. Usually .plainText or .html.

Methods

encode(_:​to:​headers:​)

public func encode<E>(_ encodable: E, to body: inout ByteBuffer, headers: inout HTTPHeaders) throws where E: Encodable

ContentEncoder conformance.