Swiftpack.co - Package - 417-72KI/MultipartFormDataParser

MultipartFormDataParser

Actions Status GitHub release Swift Package Manager Carthage Compatible GitHub license

Testing tool for multipart/form-data in Swift

Usage

example

let request: URLRequest = ...
do {
    let data = try MultipartFormData.parse(from: request)
    let genbaNeko = try XCTUnwrap(data.element(forName: "genbaNeko"))
    let denwaNeko = try XCTUnwrap(data.element(forName: "denwaNeko"))
    let message = try XCTUnwrap(data.element(forName: "message"))
    XCTAssertNotNil(Image(data: genbaNeko.data))
    XCTAssertEqual(genbaNeko.mimeType, "image/jpeg")
    XCTAssertNotNil(Image(data: denwaNeko.data))
    XCTAssertEqual(denwaNeko.mimeType, "image/jpeg")
    XCTAssertEqual(message.string, "Hello world!")
} catch {
    XCTFail(error.localizedDescription)
}

Github

link
Stars: 11

Used By

Total: 0

Releases

1.1.1 - 2020-08-31 04:48:09

Fixed

  • Fix Infinite Loop within extractData (#9) by @paulryanclark

1.1.0 - 2020-08-09 03:31:43

1.1.0

1.0.0 - 2019-12-16 08:53:04

1.0.0