Fix default EndpointSuffix when parsing connection string (#981)

This commit is contained in:
Gabor Gyimesi 2020-11-16 02:58:01 +01:00 committed by GitHub
parent 8aebd51c22
commit a716e094fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -69,6 +69,7 @@ target_sources(
PRIVATE
test/bearer_token_test.cpp
test/crypt_functions_test.cpp
test/storage_credential_test.cpp
test/test_base.cpp
test/test_base.hpp
)
@ -85,7 +86,7 @@ target_sources(
sample/main.cpp
sample/samples_common.hpp
)
target_include_directories(azure-storage-sample PUBLIC sample)
generate_documentation(azure-storage-common ${AZ_LIBRARY_VERSION})

View File

@ -51,7 +51,7 @@ namespace Azure { namespace Storage { namespace Details {
std::string defaultEndpointsProtocol
= getWithDefault(connectionStringMap, "DefaultEndpointsProtocol", "https");
std::string EndpointSuffix
= getWithDefault(connectionStringMap, "EndpointSuffix", ".core.windows.net");
= getWithDefault(connectionStringMap, "EndpointSuffix", "core.windows.net");
std::string accountName = getWithDefault(connectionStringMap, "AccountName");
std::string endpoint = getWithDefault(connectionStringMap, "BlobEndpoint");

View File

@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "azure/storage/common/storage_credential.hpp"
#include "test_base.hpp"
namespace Azure { namespace Storage { namespace Test {
TEST(StorageCredentialTest, DefaultHostCorrect)
{
EXPECT_EQ(Azure::Storage::Details::ParseConnectionString(
"DefaultEndpointsProtocol=https;AccountName=testaccount;AccountKey=testkey").BlobServiceUri.GetHost(), "testaccount.blob.core.windows.net");
}
}}} // namespace Azure::Storage::Test