Using Header and BasicHeader with HttpUrlConnection in android -
in android 6.0 org.apache.http.legacy
library deprecated, try migrate project use httpurlconnection
. in project, used header
, basicheader
. didn't found how can replace these classes httpurlconnection
. want know how can add header in request using httpurlconnection
.
url url=new url("yoururl"); httpurlconnection connection= (httpurlconnection) url.openconnection();//establishing connection url connection.setdooutput(true); connection.setrequestmethod("post");//method type connection.setrequestproperty("content-type","application/json");// setting headers
Comments
Post a Comment