Body

public struct Body

Represent request body.

  • Chunk provider.

    See more

    Declaration

    Swift

    public struct StreamWriter
  • Body size. Request validation will be failed with HTTPClientErrors.contentLengthMissing if nil, unless Trasfer-Encoding: chunked header is set.

    Declaration

    Swift

    public var length: Int?
  • Body chunk provider.

    Declaration

    Swift

    public var stream: (StreamWriter) -> EventLoopFuture<Void>
  • Create and stream body using ByteBuffer.

    Declaration

    Swift

    public static func byteBuffer(_ buffer: ByteBuffer) -> Body

    Parameters

    buffer

    Body ByteBuffer representation.

  • Create and stream body using StreamWriter.

    Declaration

    Swift

    public static func stream(length: Int? = nil, _ stream: @escaping (StreamWriter) -> EventLoopFuture<Void>) -> Body

    Parameters

    length

    Body size. Request validation will be failed with HTTPClientErrors.contentLengthMissing if nil, unless Transfer-Encoding: chunked header is set.

    stream

    Body chunk provider.

  • Create and stream body using Data.

    Declaration

    Swift

    public static func data(_ data: Data) -> Body

    Parameters

    data

    Body Data representation.

  • Create and stream body using String.

    Declaration

    Swift

    public static func string(_ string: String) -> Body

    Parameters

    string

    Body String representation.