Hey all,
I'm trying to upload a gzipped json to a microservice and I can't make this request to work in Rest-assured.
Here's the request I'm trying to make, that works perfectly when send using cURL or any REST client:
curl -v -s -XPOST --url http://54.164.67.59/omnivore/tickets -H 'Content-Type: application/json' -H 'Content-Encoding: gzip' --data-binary @/Users/mikehicks/Dev/Github/pos-srv/omnivore/testdata/ticket_added.json.gz
Multi-part form data uploading method doesn't work with the micro-service I'm working on.
Here's how I send it:
String gzippedBinary = "/Users/mikehicks/Dev/Github/qa-tests/src-pos/test/resources/testOmnivoreTickets/ticket_added.json.gzip";
File file = new File(gzippedBinary);
byte[] array = Files.readAllBytes(file.toPath());
InputStream inputStream = new FileInputStream(file);
Response response =
given()
.body(array)
.header("Content-Encoding", "gzip")
.header("Content-Type", "application/json")
.when()
.post("/omnivore/tickets")
.then()
.extract()
.response();
Here's what is being actually sent:
Looks like the encoding is different and it's not an actual gzipped file.
Here's the successful request sent using a reset client:
Any help appreciated.
Thanks!