如何在C ++ REST SDK中获取服务器认证数据?

时间:2018-10-10 07:00:20

标签: c++ cpprest-sdk

当web :: http :: client :: http_client :: request失败时,我想检查服务器认证的信息。 有什么办法吗?

sample code 
#include <Windows.h>
#include <iostream>
#include <cpprest/http_client.h>

using namespace web;
using namespace web::http;
using namespace web::http::client;

pplx::task<void> Get()
{
  return pplx::create_task([]
  {
    http_client client(L"https://jsonplaceholder.typicode.com/posts/1");
    return client.request(methods::GET);
  }).then([](http_response response)
  {
    if (response.status_code() == status_codes::OK)
    {
      return response.extract_json();
    }
    else
    {
        ★I'd like to get the information of Server Certificate, here.
    }

  }).then([](json::value json)
  {
    std::wcout << json[L"title"].as_string() << std::endl;
  });
}

0 个答案:

没有答案