Exchange does not send MultiPartFile and explodes, the file is load in memory dosnt send in parts, this is the method, any idea?
public void create(CreateCollectionRequest cmd) {
final CreateCollectionRestModel request = CreateCollectionRestModel.from(cmd);
log.info("Creating collection with {}", request);
final URI uri = UriComponentsBuilder.fromUriString(config.Repository().getUrl() + COLLECTION_RESOURCE)
.queryParam("code",160)
.build().toUri();
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
//File tempFile = File.createTempFile("xyz", "");
//FileCopyUtils.copy(multipartFile.getInputStream(), new FileOutputStream(tempFile));
body.add("file", cmd.getContent().getResource());
HttpEntity<MultiValueMap<String, Object>> httpEntity =
new HttpEntity<>(body, headersProvider.get("xxxx", "xxxx"));
restTemplate.exchange(
uri,
HttpMethod.POST,
httpEntity,
Object.class)
.getBody();
}