android - Volley Content-Type header not updating -



android - Volley Content-Type header not updating -

i trying write post phone call in volley, send xml body server. cannot set content-type header correctly.

the basic stringrequest looks this:

stringrequest folderrequest = new stringrequest(method.post, submitinterviewurl, mylistener, myerrorlistener) { @override public byte[] getbody() throws authfailureerror { string body = "some text"; seek { homecoming body.getbytes(getparamsencoding()); } grab (unsupportedencodingexception uee) { throw new runtimeexception("encoding not supported: " + getparamsencoding(), uee); } } @override public map<string, string> getheaders() throws authfailureerror { map<string, string> headers = new hashmap<string, string>(); headers.put("content-type", "application/xml"); homecoming headers; } };

i override getheaders() supply content-type header want - application/xml.

that based on suggestions questions similar one:

android volley post request header not changing

when request sent, volley has added sec content-type header automatically, headers this:

content-type: application/xml content-type: application/x-www-form-urlencoded; charset=utf-8

how set right header? or remove wrong header?

i have tried tracing through base of operations request code, have been unable find header comes from.

the content-type header not treated same way other headers volley. in particular, overriding getheaders() alter content type not work.

the right way override getbodycontenttype():

public string getbodycontenttype() { homecoming "application/xml"; }

i found looking @ code jsonrequest class.

delyan mentions in reply related question:

how execute set request in android volley?

android android-volley

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -