Closed clfristoe closed 6 years ago
Try APIMATIC. It will generate the right code for you.
Can you be a little bit more specific? The api I am making the call to only accepts byte arrays and right now the request.body() only accepts strings. http://d.pr/i/RBU1mj
This is a fairly old library. It was made for a code-generator called APIMATIC. The code generator has since moved on to use better approach for file uploading. I think in the long run, it will benefit to use APIMATIC to write the code for you.
But you want to use this library as is, may be have a look at the line 68 of src/main/java/com/mashape/unirest/request/HttpRequestWithBody.java. This method allows you to attach a file directly rather than having to load it into a byte array first.
Is there a way to add a body with a byte array to an HttpRequestWithBody? I am trying to upload images to a server.