I am trying to write a POST call in Volley, to send an XML body to the server. I cannot set the Content-Type
header correctly.
The basic StringReq
The Content-Type
header is not treated the same way as other headers by Volley. In particular, overriding getHeaders()
to change the content type does not always work.
The correct way to do this is to override getBodyContentType()
:
public String getBodyContentType()
{
return "application/xml";
}
I found this by looking at the code for the JsonRequest
class.
Delyan also mentions it in his answer to this related question: