fix regression on contex value implementation for Storage (#1862)
This commit is contained in:
parent
23b698f2c6
commit
c0ce9688d6
@ -177,9 +177,17 @@ struct SomeStructForContext
|
||||
int someField = 12345;
|
||||
};
|
||||
|
||||
TEST(Context, UniquePtr)
|
||||
TEST(Context, InstanceValue)
|
||||
{
|
||||
auto contextP = Context::GetApplicationContext().WithValue("struct", SomeStructForContext());
|
||||
auto& contextValueRef = contextP.Get<SomeStructForContext>("struct");
|
||||
EXPECT_EQ(contextValueRef.someField, 12345);
|
||||
}
|
||||
|
||||
TEST(Context, UniquePtr)
|
||||
{
|
||||
auto contextP = Context::GetApplicationContext().WithValue(
|
||||
"struct", std::make_unique<SomeStructForContext>());
|
||||
auto& contextValueRef = contextP.Get<std::unique_ptr<SomeStructForContext>>("struct");
|
||||
EXPECT_EQ(contextValueRef->someField, 12345);
|
||||
}
|
||||
|
||||
@ -13,7 +13,9 @@ namespace Azure { namespace Storage { namespace _detail {
|
||||
SecondaryHostReplicaStatus* replicaStatus = nullptr;
|
||||
if (ctx.HasKey(SecondaryHostReplicaStatusKey))
|
||||
{
|
||||
replicaStatus = ctx.Get<SecondaryHostReplicaStatus*>(SecondaryHostReplicaStatusKey);
|
||||
replicaStatus
|
||||
= ctx.Get<std::unique_ptr<SecondaryHostReplicaStatus>>(SecondaryHostReplicaStatusKey)
|
||||
.get();
|
||||
}
|
||||
|
||||
bool considerSecondary = (request.GetMethod() == Azure::Core::Http::HttpMethod::Get
|
||||
|
||||
Loading…
Reference in New Issue
Block a user