Vapor Documentation Beta

Structure Multipart​Part

public struct MultipartPart: Equatable

A single part of a multipart-encoded message.

%3 MultipartPart MultipartPart MultipartPartConvertible MultipartPartConvertible MultipartPart->MultipartPartConvertible Equatable Equatable MultipartPart->Equatable

Conforms To

MultipartPartConvertible
Equatable

Initializers

init(headers:​body:​)

public init(headers: HTTPHeaders = .init(), body: String)

Creates a new MultipartPart.

let part = MultipartPart(headers: ["Content-Type": "text/plain"], body: "hello")

Parameters

headers HTTPHeaders

The part's headers.

body String

The part's data.

init(headers:​body:​)

public init<Data>(headers: HTTPHeaders = .init(), body: Data) where Data: DataProtocol

Creates a new MultipartPart.

let part = MultipartPart(headers: ["Content-Type": "text/plain"], body: "hello")

Parameters

headers HTTPHeaders

The part's headers.

body Data

The part's data.

init(headers:​body:​)

public init(headers: HTTPHeaders = .init(), body: ByteBuffer)

init?(multipart:​)

public init?(multipart: MultipartPart)

Properties

content​Type

var contentType: String?

filename

var filename: String?

content​Disposition

var contentDisposition: HTTPHeaders.ContentDisposition?

headers

var headers: HTTPHeaders

The part's headers.

body

var body: ByteBuffer

The part's raw data.

name

var name: String?

Gets or sets the name attribute from the part's "Content-Disposition" header.

multipart

var multipart: MultipartPart?