一般POST提交都是基于表單提交,即提交的時(shí)候會(huì)攜帶Content-Type="application/x-www-form-urlencoded"
使用方式如下:
String responseData = HttpClient .post("http://localhost:8080/okhttp-server-test/userInfo/create") //請(qǐng)求方式和請(qǐng)求url .param("username","mzlion") // 表單參數(shù) .param("userPwd", "123") // 表單參數(shù) //queryString("queryTime","20160530") //url參數(shù) .execute() .asString(); //formParam()重載方法還支持`Map<String,String>`
更多建議: