File tree Expand file tree Collapse file tree
Sources/MultipartFormData
Tests/MultipartFormDataTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ extension MultipartFormData {
116116 /// This combines all the data from the subparts into one big data object.
117117 public var httpBody : Data {
118118 let bodyData : Data = body
119- . map { . _dash + boundary . _asciiData + . _crlf + $0. _data + . _crlf }
119+ . map { . _dash + boundary . _asciiData + . _crlf + $0. data + . _crlf }
120120 . reduce ( Data ( ) , + )
121121 return bodyData + . _dash + boundary. _asciiData + . _dash + . _crlf
122122 }
Original file line number Diff line number Diff line change @@ -80,14 +80,15 @@ extension Subpart {
8080
8181extension Subpart : CustomDebugStringConvertible {
8282 public var debugDescription : String {
83- return String ( bytes: _data , encoding: . utf8) ?? " "
83+ return String ( bytes: data , encoding: . utf8) ?? " "
8484 }
8585}
8686
8787// MARK: - Helpers
8888
8989extension Subpart {
90- internal var _data : Data {
90+ /// The data representation of a subpart.
91+ public var data : Data {
9192 let contentTypeData : Data = contentType. map { $0. data + . _crlf } ?? Data ( )
9293 return contentDisposition. data + . _crlf + contentTypeData + . _crlf + body
9394 }
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ final class SubpartTests: XCTestCase {
2121 " " ,
2222 " a " ,
2323 ] . joined ( separator: " \r \n " ) . utf8)
24- XCTAssertEqual ( subpart. _data , expectedData)
24+ XCTAssertEqual ( subpart. data , expectedData)
2525 }
2626
2727 func testDebugDescription( ) {
You can’t perform that action at this time.
0 commit comments