I'm trying to do a post to an endpoint and set some form params and a file using AsyncHttp
.
This is the code I have:
httpClient.preparePost(url)
.addHeader(HttpHeaders.AUTHORIZATION, authorizationToken)
.addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
.addFormParam("type", type)
.addBodyPart(new ByteArrayPart("file", file.getBytes()))
.execute()
.get();
Right now I am getting 4xx, but if I do it with postman it works and I get 201
.
What am I doing wrong?