I discovered this on spring-boot 2.1 I can reproduce the same behaviour using spring-boot 2.2.2.
I'm trying to post binary Content with a specified Content-Type Header using WebClient:
WebClient.create().post().uri(MY_URI)
.contentType(MediaType.APPLICATION_PDF)
.body(BodyInserters.fromResource(myResource))
.exchange()
in some cases the request was made with Content-Type: application/octet-stream instead of application/pdf.
Apparently the RessourceHttpMessageWriter will set the Content-Type Header based on the resources filename overwriting the explicitly set contentType on the Request in ResourceHttpMessageWriter.writeResource.
See https://github.com/hgarus/webclient-content-type-example/blob/master/src/test/java/com/example/demo/WebClientContentTypeTest.java for a minimal testcase.