Closed GoogleCodeExporter closed 9 years ago
Perhaps you could try using the
com.jayway.restassured.builder.MultiPartSpecBuilder and see if that works
Original comment by johan.ha...@gmail.com
on 19 Nov 2013 at 6:47
Closing because of no response from the issuer
Original comment by johan.ha...@gmail.com
on 4 Jun 2014 at 1:38
MultiPartSpecBuilder does not resolve the issue same type of error. I see only
empty bodies on the wire.
Workaround build the body via http client classes:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
File upload = new File("upload.txt");
final String boundary = "-8<--- my simple boundary -->8---";
HttpEntity data = MultipartEntityBuilder.create()
.setBoundary(boundary)
.addTextBody("metadata", "{ \"foo\": \"bar\" }", org.apache.http.entity.ContentType.APPLICATION_JSON)
.addBinaryBody("file", upload, org.apache.http.entity.ContentType.create("application/zip"), upload.getName())
.build();
data.writeTo(bos);
ValidatableResponse response = given()
.contentType("multipart/mixed; boundary=\"" + boundary + "\"")
.body(bos.toByteArray())
.post("/my-multi-part-mixed")
..... etc
Original comment by ric.kla...@gmail.com
on 17 Apr 2015 at 8:57
Original issue reported on code.google.com by
bwalli...@gmail.com
on 4 Mar 2013 at 12:25