hey channel.
I’ve been trying to implement a POST with a ByteArray using this:
<http://requestBuilder.POST|requestBuilder.POST>(HttpRequest.BodyPublishers.ofByteArray(payload.httpBody.toByteArray()))
but in the controller I get:
Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type ‘application/octet-stream;charset=UTF-8’ not supported]
My Controller:
@RestController
@CrossOrigin
@RequestMapping(path = "/")
public class IngestionMockerController {
@PostMapping(value = "/")
public ResponseEntity<String> post(
@RequestBody Byte[] body) {
System.out.println("HttpRequestIngestionRequest = " + Arrays.stream(body).toArray());
return new ResponseEntity<>(HttpStatus.CREATED);
}
}
Please, could someone share an example of HTTP Client posting a ByteArray to a POST endpoint (@RequestBody Byte[] body)?