java - How is HTTP Header set in Spring RestTemplate? -
i wanted plain string, not json. code @ client side:
httpheaders headers = new httpheaders(); headers.setaccept(collections.singletonlist(mediatype.text_plain)); httpentity<string> entity = new httpentity<string>("", headers); resttemplate resttemplate = new resttemplate(); responseentity<string> tickerresponse = resttemplate.exchange(servicebase, httpmethod.get, entity,string.class);
it works in local unit test. log looks like:
08:24:46,291 debug resttemplate:598 - setting request accept header [text/plain, /]
however, doesn't work in tomcat, log was:
08:20:48,362 debug resttemplate:598 - setting request accept header [application/json, application/*+json, text/plain, /]
i guess resttemplate set accept header json default when running in tomcat 8. how clean default settings?
Comments
Post a Comment