qq_25696379
寒樱白花
2019-04-20 14:03

开源中国登陆url没有响应

5
  • android-studio
  • android

听马伟奇的《十分钟完成开源中国》仿写,写登陆模块时访问https://www.oschina.net/action/api/login_validate

提交参数"keep_login","username","pwd"无响应,不能返回登陆结果字符串,请问这是怎么回事?

public class LoginActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    Request request = ItheimaHttp.newGetRequest("action/api/login_validate");
    request.putParams("keep_login",1)
            .putParams("username","xx@qq.com")
            .putParams("pwd","xx");
    Call call = ItheimaHttp.send(request, new HttpResponseListener<String>() {

        @Override
        public void onResponse(String s, Headers headers) {
            System.out.println(s);
        }
    });
}

}
响应函数是运行了的,但是字符串里面是空的,日志也没有报错。

数据请求用的https://github.com/open-android/RetrofitUtils

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换