Forum Discussion

jimmybygrave's avatar
jimmybygrave
Occasional Visitor
7 months ago

Invalid Zip file cucumber automation

Hey all, I'm trying to upload my result to our JIRA instance but I am getting an invalid zip file error and I'm not sure where I'm messing up. Once I create my json file, I compress to zip format and use postman to try to push my results.

{
"errorMessages": [
"Invalid ZIP file"
]
}

Here is the postman script that is run with the zip file as  the package. Any help is appreciated!

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM).addFormDataPart("","data.json.zip",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("/path/data.json.zip"))).build();
Request request = new Request.Builder().url("myURL").method("POST", body).addHeader("Authorization", "myAUth").addHeader("Cookie", "myCookie").build();
Response response = client.newCall(request).execute();

No RepliesBe the first to reply