fngang 2015-10-20 16:23 采纳率: 25%
浏览 1816
已采纳

xutils的http请求结果

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);
        }

    };
  • 写回答

2条回答 默认 最新

  • threenewbee 2015-10-20 22:37
    关注

    怀疑是你请求的地址错误或者什么问题,产生的html是什么,有没有提示信息一类有用的信息,用fiddler看下。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?