PlaintextEncoder

public final class PlaintextEncoder : DataEncoder, HTTPMessageEncoder

Encodes data as plaintext, utf8.

  • Creates a new PlaintextEncoder.

    Declaration

    Swift

    public init(_ contentType: MediaType = .plainText)

    Parameters

    contentType

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

  • See DataEncoder.

    Declaration

    Swift

    public func encode<E>(_ encodable: E) throws -> Data where E : Encodable
  • See HTTPMessageEncoder.

    Declaration

    Swift

    public func encode<E, M>(_ encodable: E, to message: inout M, on worker: Worker) throws
        where E: Encodable, M: HTTPMessage