Could you share how to build Converter
for a custom Mime Type (which contains invalid token character) in Spring Web?
I have been working in a scenario to call to an REST API that responds with Content-Type=application/octet-stream .pdf
. And Spring rest template could not parse the mime type.
Caused by: org.springframework.util.InvalidMimeTypeException: Invalid mime type "application/octet-stream .pdf": Invalid token character ' ' in token "octet-stream .pdf"
at org.springframework.util.MimeTypeUtils.parseMimeTypeInternal(MimeTypeUtils.java:275) ~[spring-core-5.3.28.jar:5.3.28]
at org.springframework.util.ConcurrentLruCache.get(ConcurrentLruCache.java:107) ~[spring-core-5.3.28.jar:5.3.28]
at org.springframework.util.MimeTypeUtils.parseMimeType(MimeTypeUtils.java:209) ~[spring-core-5.3.28.jar:5.3.28]
at org.springframework.http.MediaType.parseMediaType(MediaType.java:631) ~[spring-web-5.3.28.jar:5.3.28]
... 20 common frames omitted