Spring WebFlux WebClient上传具有自定义ContentType的InputStream

时间:2019-04-29 10:55:20

标签: spring spring-webflux

我想使用InputStream和以下代码将BodyInserters.fromResource上传到某个URL:

   WebClient.create()
            .put()
            .uri(URI.create(link))
            .body(BodyInserters.fromResource(new InputStreamResource(mimeMessage.getRawInputStream())))
            .header(HttpHeaders.CONTENT_TYPE, "application/my-content-type")

主要目标是将Content-Type标头更改为自定义名称,但是当我测试该标头时,我发现该URL是使用application/octet-stream Content-Type请求的。如何强制WebClient选择我的自定义Content-Type?

我的Spring Boot版本2.1.4.RELEASE

0 个答案:

没有答案
相关问题