MultipartFormData
public class MultipartFormData
Object encapsulating a multipart form.
-
String denoting the
Content-Typeof the request header.Declaration
Swift
public var contentType: String { get } -
Initialize a
MultipartFormDatainstance.Declaration
Swift
public init() -
Append a new body part to the multipart form, where the original data is in a file described by the
fileNamestring.Declaration
Swift
public func append(_ data: Data, withName: String, mimeType: String? = nil, fileName: String? = nil)Parameters
DataThe data of the body part.
withNameThe name/key of the body part.
mimeTypeThe MIME type of the body part.
fileNameThe name of the file the data came from.
Return Value
Returns a
Dataobject encompassing the combined body parts. -
Append a new body part to the multipart form, where the original data is in a url described by
fileURL.Declaration
Swift
public func append(_ fileURL: URL, withName: String, mimeType: String? = nil)Parameters
fileURLThe url to extract the data from.
withNameThe name/key of the body part.
mimeTypeThe MIME type of the body part.
Return Value
Returns a
Dataobject encompassing the combined body parts. -
Combine the multipart form body parts into a single
Dataobject.Declaration
Swift
public func toData() throws -> DataReturn Value
Returns a
Dataobject encompassing the combined body parts.
View on GitHub
MultipartFormData Class Reference