I have the following code:
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAccept(Collections.singletonList(new MediaType("text","plain;charset=UTF-8")));
However this throw me an IllegalArgumentException. The problem is that I want to set the charset as UTF-8 without change it from the config file. Is this possible?
According to the API doc
IllegalArgumentExceptionis thrown ifMediaTypefails to convert itself toString.Try the following: