Is it possible to provide a byte array instead of a File to the Http.outboundGateway
for multi-part? This implementation is supported by the REST template (see: https://medium.com/@voziv/posting-a-byte-array-instead-of-a-file-using-spring-s-resttemplate-56268b45140b).
When I'm using the above snippet, I'm getting:
Caused by: java.lang.IllegalArgumentException: Message payload must be of type [java.io.File]: java.lang.String
Snippet:
.transform(m -> {
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
ByteArrayResource contentsAsResource = new ByteArrayResource((byte[]) m) {
@Override
public String getFilename() {
return "temp";
}
};
body.add("document", contentsAsResource);
return body;
})
.handle(Http.outboundGateway(uri)
.httpMethod(HttpMethod.POST)
.expectedResponseType(String.class), this.advices.spec())