我正在尝试使用 cpprest sdk 在我的 Azure 存储帐户中列出 blob,这是我的代码:
pplx::task<void> HTTPRequestCustomHeadersAsync()
{
http_client client(L"https://<account-name>.blob.core.windows.net/?comp=list");
// Manually build up an HTTP request with header and request URI.
http_request request(methods::GET);
request.headers().add(L"Authorization", L"Sharedkey <account-name>:<account-key>");
request.headers().add(L"x-ms-date", L"Thu, 08 Feb 2018 20:31:55 GMT ");
request.headers().add(L"x-ms-version", L"2017-07-29");
return client.request(request).then([](http_response response)
{
// Print the status code.
std::wostringstream ss;
ss << L"Server returned returned status code " << response.status_code() << L"." << std::endl;
std::wcout << ss.str();
});
/* Sample output:
Server returned returned status code 200.
*/
}
我一直收到返回的状态码为 403。如果我做得对,有人可以告诉我吗?