Xamarin + RestSharp请求返回空JSON

时间:2017-03-07 14:17:17

标签: xamarin flask getjson restsharp

我正在尝试从Flask-RESTful API获取JSON,而不是:

  [
   [
    {
      "c_t": [],
      "imie": "test",
      "login": "test2",
      "nazwisko": "test3",
      "oferty": [],
      "password": "passpass",
      "user_id": 13,
      "u_t": []
    }
  ],
  {}
]

我得到空字符串作为response.Content。这是我的代码:

var client = new RestClient("https://SERVER-IP");
var request = new RestRequest("/users", Method.GET);

request.AddHeader("Content-Type", "application/json");

client.ExecuteAsync(request, response =>
{
 RunOnUiThread(delegate
 {
    var responseC = response.Content;

    Toast.MakeText(this, responseC, Toast.Length.Long).Show();
 });
});

1 个答案:

答案 0 :(得分:1)

使用 http 代替 https ;)这就是我们修复它的原因。