1

I use Httpclient to call web api, here is the raw value from the web api:

{
    "success": true,
    "msg": "OK",
    "sessionId": "oYVwr5CTBk_v3juMH6SXmcwqhC11",
}

and here is the code of the caller:

using (var client = new HttpClient())
{
    client.BaseAddress = new Uri(WeiXinServiceUrl);
    var response = await client.GetAsync(
         $"/API/Open/OnLogin?appid={appID}&code={code}");

    if (response.IsSuccessStatusCode)
    {
         var result = await response.Content.ReadAsAsync<
              (bool success, string msg, string sessionId)>();

         return result;
    }
}

well, the result is default tuple (which is indeed not what I expect/want):

(false, null, null)
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Ricky Zhou
  • 99
  • 8

0 Answers0