Issue
We have a restTemplate
with
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
but for out usage we need to set up custom Content-Type header
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
but headers.setContentType()
doesn't accept just String. How to work it around?
Solution
I misunderstood your question; hence removed old post
For setting custom header type you can do following:
headers.set(HttpHeaders.CONTENT_TYPE,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
Headers#setContentType
is internally calling headers.set(String,String)
only which I used above.
Answered By - Ashish Patil
Answer Checked By - Pedro (JavaFixing Volunteer)