Skip to content

Commit

Permalink
Merge pull request #2 from MMP0/patch-1
Browse files Browse the repository at this point in the history
Add missing CRLF epilogue
  • Loading branch information
FelixHerrmann authored Feb 1, 2022
2 parents 8652854 + fa26517 commit 19f4e7a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/MultipartFormData/MultipartFormData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension MultipartFormData {
let bodyData = body
.map { ._dash + boundary._asciiData + ._crlf + $0._data + ._crlf }
.reduce(Data(), +)
return bodyData + ._dash + boundary._asciiData + ._dash
return bodyData + ._dash + boundary._asciiData + ._dash + ._crlf
}
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/MultipartFormDataTests/MultipartFormDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ final class MultipartFormDataTests: XCTestCase {
"Content-Type: application/octet-stream",
"",
"",
"--test--"
"--test--\r\n"
].joined(separator: "\r\n").utf8)
XCTAssertEqual(multipartFormData.httpBody, expectedBody)
}
Expand Down Expand Up @@ -69,7 +69,7 @@ final class MultipartFormDataTests: XCTestCase {
"Content-Type: application/octet-stream",
"",
"",
"--test--"
"--test--\r\n"
].joined(separator: "\r\n")
XCTAssertEqual(multipartFormData.debugDescription, expectedDescription)
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/MultipartFormDataTests/URLRequestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class URLRequestTests: XCTestCase {
"Content-Disposition: form-data; name=\"a\"",
"",
"",
"--test--",
"--test--\r\n",
].joined(separator: "\r\n").utf8)
XCTAssertEqual(request.httpBody, expectedBody)
}
Expand Down

0 comments on commit 19f4e7a

Please sign in to comment.