【发布时间】:2019-04-15 19:02:23
【问题描述】:
我开始使用 Spring WebClient 向外部服务发送请求。 其中一项不受我控制的服务以 Json 响应,但响应标头中有 Content-Type“文本”。
status: 200
server: nginx/1.12.2
date: Tue, 13 Nov 2018 01:48:23 GMT
content-type: text
当我调用bodyToMono(String.class) 或toEntity(String.class) 时,这会使WebClient 失败并出现以下异常:
Caused by: org.springframework.util.InvalidMimeTypeException: Invalid mime type "text": does not contain '/'
我试图在这里查看我的选项,但我没有看到。 我无法即时更改标题(我看到了这篇文章:Reactive WebClient GET Request with text/html response 但它不起作用) 我无法让 WebClient 接受没有 / 的 mime 类型。
有人可以帮忙吗?
【问题讨论】:
标签: spring spring-webflux