xutils的http請求結果(正確請求)本應是json數據,在浏覽器已測試,但我請求的結果是html標簽,請各路大神幫下忙,謝謝!
下面附代碼:
public void httpRequest(String url,HttpMethod method,RequestParams params){
HttpUtils http=new HttpUtils();
http.send(method, url, params, callBack);
}
private RequestCallBack<String> callBack=new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> response) {
Log.i("mc","http請求結果是:"+response.result);
//請求結果應該是這樣的:
//{“res":"","success":true,"info":"登陸成功"},{"res":"","success":false,"info":"用戶名或密碼錯誤"}
//實際請求結果請看附件圖片,返回的結果是html標簽
}
@Override
public void onFailure(HttpException exception, String arg1) {
Toast.makeText(activity, "http請求失敗,原因是:"+exception.toString()+","+arg1, 1).show();
Log.i("mc","http請求失敗,原因是:"+exception.toString()+","+arg1);
}
};
懷疑是你請求的地址錯誤或者什麼問題,產生的html是什麼,有沒有提示信息一類有用的信息,用fiddler看下。