CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"Sources","path":"Sources","contentType":"directory"},{"name":"Tests","path":"Tests","contentType":"directory"},{"name":"scripts","path":"scripts","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":".swiftlint.yml","path":".swiftlint.yml","contentType":"file"},{"name":"Dangerfile.swift","path":"Dangerfile.swift","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"Makefile","path":"Makefile","contentType":"file"},{"name":"MultipartFormDataParser.podspec","path":"MultipartFormDataParser.podspec","contentType":"file"},{"name":"Package.swift","path":"Package.swift","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":12}},"fileTreeProcessingTime":6.292946,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":227887282,"defaultBranch":"main","name":"MultipartFormDataParser","ownerLogin":"417-72KI","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2019-12-13T17:08:09.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/4150060?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"2.0.1","listCacheKey":"v0:1690906752.0","canEdit":false,"refType":"tag","currentOid":"f987d91162ebd2fd185c1bc1d024cad067e2db5e"},"path":"README.md","currentUser":null,"blob":{"rawLines":null,"stylingDirectives":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/417-72KI/MultipartFormDataParser/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/417-72KI/MultipartFormDataParser/security/dependabot","repoSecurityAndAnalysisPath":"/417-72KI/MultipartFormDataParser/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"README.md","displayUrl":"https://github.com/417-72KI/MultipartFormDataParser/blob/2.0.1/README.md?raw=true","headerInfo":{"blobSize":"3.7 KB","deleteInfo":{"deletePath":null,"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":null,"gitLfsPath":null,"onBranch":false,"shortPath":"6b61133","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2F417-72KI%2FMultipartFormDataParser%2Fblob%2F2.0.1%2FREADME.md","isCSV":false,"isRichtext":true,"toc":[{"level":1,"text":"MultipartFormDataParser","anchor":"multipartformdataparser","htmlText":"MultipartFormDataParser"},{"level":2,"text":"Installation","anchor":"installation","htmlText":"Installation"},{"level":3,"text":"Swift Package Manager (recommended)","anchor":"swift-package-manager-recommended","htmlText":"Swift Package Manager (recommended)"},{"level":4,"text":"Package.swift","anchor":"packageswift","htmlText":"Package.swift"},{"level":3,"text":"CocoaPods","anchor":"cocoapods","htmlText":"CocoaPods"},{"level":4,"text":"Podfile","anchor":"podfile","htmlText":"Podfile"}],"lineInfo":{"truncatedLoc":"81","truncatedSloc":"69"},"mode":"file"},"image":false,"isCodeownersFile":null,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Markdown","large":false,"loggedIn":false,"newDiscussionPath":"/417-72KI/MultipartFormDataParser/discussions/new","newIssuePath":"/417-72KI/MultipartFormDataParser/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/417-72KI/MultipartFormDataParser/blob/2.0.1/README.md","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/417-72KI/MultipartFormDataParser/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"renderImageOrRaw":false,"richText":" Testing tool for When to upload some files via API, we must use Most famous networking libraries (e.g. Alamofire, APIKit) can implement easily.\nHowever, to test if the created request is as expected is difficult and bothering. This library provides a parser for Using OHHTTPStubs, we can test a request created by networking libraries easily.MultipartFormDataParser
\n\nmultipart/form-data request in Swift.multipart/form-data for request.\nmultipart/form-data is defined as RFC-2388multipart/form-data request to test it briefly.let request: URLRequest = …\ndo {\n let data = try MultipartFormData.parse(from: request)\n let genbaNeko = try XCTUnwrap(data.element(forName: \"genbaNeko\"))\n let message = try XCTUnwrap(data.element(forName: \"message\"))\n XCTAssertNotNil(Image(data: genbaNeko.data))\n XCTAssertEqual(genbaNeko.mimeType, \"image/jpeg\")\n XCTAssertEqual(message.string, \"Hello world!\")\n} catch {\n XCTFail(error.localizedDescription)\n}
let expectedGenbaNeko: Data = …\n\nlet condition = isHost(\"localhost\") && isPath(\"/upload\")\nstub(condition: condition) { request in\n let errorResponse = { (message: String) -> HTTPStubsResponse in\n .init(\n jsonObject: [\"status\": 403, \"error\": message],\n statusCode: 403, \n headers: [\"Content-Type\": \"application/json\"]\n )\n }\n do {\n let data = try MultipartFormData.parse(from: request)\n guard let genbaNeko = data.element(forName: \"genbaNeko\"),\n genbaNeko.data == expectedGenbaNeko else { return errorResponse(\"Unexpected genbaNeko\") }\n guard let message = data.element(forName: \"message\"),\n message.string == \"Hello world!\" else { return errorResponse(\"Unexpected message: \(message)\") }\n } catch {\n return .init(error: error)\n }\n return .init(\n jsonObject: [\"status\": 200],\n statusCode: 200,\n headers: [\"Content-Type\": \"application/json\"]\n )\n}
Installation
\nSwift Package Manager (recommended)
\nPackage.swift
\ndependencies: [\n .package(url: \"https://github.com/417-72KI/MultipartFormDataParser.git class=\"pl-pds\">\", from: \"2.0.1\")\n]
CocoaPods
\nPodfile
\npod 'MultipartFormDataParser'