PlainBodyProvider

public protocol PlainBodyProvider

A provider for plain text body data.

The PlainBodyProvider protocol defines a type that provides a body for plain text data. It requires conforming types to specify an associated type Body that conforms to the Encodable protocol and to provide a body property of that type.

Example usage:

struct MyPlainRequest: PlainBodyProvider {
    struct Body: Encodable {
        let content: String
    }

    var body: Body
    var encoding: String.Encoding
}
  • The body of the plain text data.

    This property holds the body of the plain text data.

    Declaration

    Swift

    var body: String { get }
  • encoding Default implementation

    The encoding used for the plain text data.

    This property holds the encoding used for the plain text data.

    Default Implementation

    The encoding used for the plain text data.

    This property holds the encoding used for the plain text data. Default implementation is .utf8

    Note

    This property is required by the PlainBodyProvider protocol.

    Declaration

    Swift

    var encoding: String.Encoding { get }