Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 3aad06a

Browse files
committed
Add an unit test to reproduce an XMLPRC upload issue
See wordpress-mobile/WordPress-iOS#22659
1 parent d67877f commit 3aad06a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

WordPressKitTests/Utilities/HTTPRequestBuilderTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,16 @@ class HTTPRequestBuilderTests: XCTestCase {
403403
)
404404
}
405405

406+
func testXMLRPCUpload() throws {
407+
let file = try XCTUnwrap(Bundle(for: type(of: self)).url(forResource: "me-settings-success", withExtension: "json"))
408+
let fileContentBase64 = try Data(contentsOf: file).base64EncodedString()
409+
let fileStream = try XCTUnwrap(InputStream(url: file))
410+
411+
let request = try HTTPRequestBuilder(url: URL(string: "https://w.org/xmlrpc.php")!)
412+
.method(.post)
413+
.body(xmlrpc: "wp.uploadFile", parameters: ["username", "passowrd", fileStream])
414+
.build(encodeBody: true)
415+
XCTAssertTrue(request.httpBodyText?.contains(fileContentBase64) == true)
416+
}
417+
406418
}

0 commit comments

Comments
 (0)