HttpURLConnection如何添加请求头?
1.conn.setRequestProPerty(name,value),两个参数都是字符串。。。。
2.用httpURLConnection的setRequestProPerty(name,value)方法,就能向header里添加信息。
如:设置content-type
httpURLConnection.setRequestProperty("token", "10051:abc"); httpURLConnection.setRequestProperty("Content-type", "application/json");