Invalid token character ':' in org.springframework.http.MediaType

140 Views Asked by At

I have a basic SpringBoot 2.3.4.RELEASE app. Using Spring Initializer, JPA, embedded Tomcat;

I want to create this MediaType

MediaType customMediaType = MediaType.parseMediaType("application/json; profile=http://realtime-listings.webservices.zpg.co.uk/docs/v2.0/schemas/listing/list.json");

that in PostMan works fine, but not in RestTemplate

ERROR at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:175) 
- Servlet.service() for servlet [dispatcherServlet] in context with path [/zoopla] threw exception [common.exception.BusinessException: 
Invalid mime type "application/json; profile=http://test.com/docs/v2.0/schemas/listing/list.json": 
Invalid token character ':' in token "http://test.com/docs/v2.0/schemas/listing/list.json"
1

There are 1 best solutions below

0
Bill Mair On

Then postman is broken if it allows it because : is not valid in a type.

See RFC 6838 and RFC 3986