我正在 MFC 框架中构建 Git 客户端,并且我正在使用 casablanca 库来与 github 服务器建立连接并使用它的 API。在 Github 教程中,一个示例显示了如何向 github 服务器发送请求,并附上用户名和密码以进行身份验证:
https ://developer.github.com/v3/#authentication
curl -i https://api.github.com -u valid_username:valid_password
现在,我已经尝试并尝试使用 Microsoft 的 casablanca 达到相同的效果,但我根本无法获得正确的语法:
http_client client(U("https://api.github.com/users/myuser"));
uri_builder builder(U("- u myuser:mypass"));
pplx::task<http_response> requestTask = client.request(methods::GET, builder.to_string());
调用此函数后,我从 casablanca 抛出异常,说 uri 无效。
知道如何在 casablanca 中正确构造请求,以便我可以将其发送到 github 服务器吗?
谢谢你。