I am starting to use Spring WebClient to send requests to external services. One of those services, not under my control, responds in Json, but has the Content-Type "text" in the response headers.
status: 200
server: nginx/1.12.2
date: Tue, 13 Nov 2018 01:48:23 GMT
content-type: text
This makes the WebClient fail with the following exception when I call either bodyToMono(String.class)
or toEntity(String.class)
:
Caused by: org.springframework.util.InvalidMimeTypeException: Invalid mime type "text": does not contain '/'
I am trying to see my options here, and I see none. I am not able to change the header on the fly (I saw this post: Reactive WebClient GET Request with text/html response but it does not work) I am not able to make WebClient accept a mime-type that has no /.
Can anybody help?