Alexandre A Barbosa
01/09/2023, 11:43 PM<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)?ashmelev
01/10/2023, 1:31 AMAlexandre A Barbosa
01/11/2023, 12:57 AMAlexandre A Barbosa
01/11/2023, 1:01 AMpublic ResponseEntity<String> post(HttpEntity<byte[]> requestEntity)
Alexandre A Barbosa
01/11/2023, 1:02 AM