Switch to return the RawResponse const& (#1852)

* Operation returns a RawResposne const&
This commit is contained in:
Rick Winter 2021-03-11 10:59:33 -08:00 committed by GitHub
parent 64c0af3f67
commit 7c862e1a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 19 additions and 14 deletions

View File

@ -53,10 +53,10 @@ namespace Azure { namespace Core {
/**
* @brief Get the raw HTTP response.
* @return A pointer to #Azure::Core::Http::RawResponse.
* @return A reference to an #Azure::Core::Http::RawResponse.
* @note Does not give up ownership of the RawResponse.
*/
virtual Azure::Core::Http::RawResponse* GetRawResponse() const = 0;
virtual Azure::Core::Http::RawResponse const& GetRawResponse() const = 0;
/**
* @brief Returns the current #Azure::Core::OperationStatus of the long-running operation.

View File

@ -48,9 +48,10 @@ public:
}
/**
* @brief Get raw HTTP response.
* @brief Get the raw HTTP response.
* @return A reference to an #Azure::Core::Http::RawResponse.
* @note Does not give up ownership of the RawResponse.
*/
// Do not give up raw response ownership.
Azure::Core::Http::RawResponse& GetRawResponse() const
{
if (!m_rawResponse)

View File

@ -58,7 +58,7 @@ namespace Azure { namespace Core { namespace Test {
}
public:
Azure::Core::Http::RawResponse* GetRawResponse() const override { return m_rawResponse.get(); }
Azure::Core::Http::RawResponse const& GetRawResponse() const override { return *m_rawResponse; }
std::string GetResumeToken() const override { return m_operationToken; }

View File

@ -79,9 +79,10 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Keys {
public:
/**
* @brief Get the #Azure::Core::Http::RawResponse of the operation request.
* @return A pointer to #Azure::Core::Http::RawResponse or null.
* @return A reference to an #Azure::Core::Http::RawResponse.
* @note Does not give up ownership of the RawResponse.
*/
Azure::Core::Http::RawResponse* GetRawResponse() const override { return m_rawResponse.get(); }
Azure::Core::Http::RawResponse const& GetRawResponse() const override { return *m_rawResponse; }
/**
* @brief Get the #Azure::Security::KeyVault::Keys::DeletedKey object.

View File

@ -84,10 +84,10 @@ namespace Azure { namespace Storage { namespace Blobs {
/**
* @brief Get the raw HTTP response.
* @return A pointer to #Azure::Core::Http::RawResponse.
* @return A reference to an #Azure::Core::Http::RawResponse.
* @note Does not give up ownership of the RawResponse.
*/
Azure::Core::Http::RawResponse* GetRawResponse() const override { return m_rawResponse.get(); }
Azure::Core::Http::RawResponse const& GetRawResponse() const override { return *m_rawResponse; }
StartCopyBlobOperation() = default;

View File

@ -207,7 +207,7 @@ namespace Azure { namespace Storage { namespace Test {
{
auto blobClient = m_blobContainerClient->GetBlobClient(RandomString());
auto res = blobClient.StartCopyFromUri(m_blockBlobClient->GetUrl());
EXPECT_NE(res.GetRawResponse(), nullptr);
EXPECT_EQ(res.GetRawResponse().GetStatusCode(), Azure::Core::Http::HttpStatusCode::Accepted);
EXPECT_FALSE(res.RequestId.empty());
EXPECT_TRUE(res.ETag.HasValue());
EXPECT_TRUE(IsValidTime(res.LastModified));

View File

@ -151,7 +151,8 @@ namespace Azure { namespace Storage { namespace Test {
Azure::Core::Url sourceUri(m_pageBlobClient->WithSnapshot(snapshot).GetUrl());
sourceUri.AppendQueryParameters(GetSas());
auto copyInfo = pageBlobClient.StartCopyIncremental(sourceUri.GetAbsoluteUrl());
EXPECT_NE(copyInfo.GetRawResponse(), nullptr);
EXPECT_EQ(
copyInfo.GetRawResponse().GetStatusCode(), Azure::Core::Http::HttpStatusCode::Accepted);
EXPECT_FALSE(copyInfo.RequestId.empty());
EXPECT_TRUE(copyInfo.ETag.HasValue());
EXPECT_TRUE(IsValidTime(copyInfo.LastModified));

View File

@ -200,10 +200,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
/**
* @brief Get the raw HTTP response.
* @return A pointer to #Azure::Core::Http::RawResponse.
* @return A reference to an #Azure::Core::Http::RawResponse.
* @note Does not give up ownership of the RawResponse.
*/
Azure::Core::Http::RawResponse* GetRawResponse() const override { return m_rawResponse.get(); }
Azure::Core::Http::RawResponse const& GetRawResponse() const override { return *m_rawResponse; }
StartCopyShareFileOperation() = default;

View File

@ -680,7 +680,9 @@ namespace Azure { namespace Storage { namespace Test {
auto destFileClient
= m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10));
auto copyOperation = destFileClient.StartCopy(fileClient.GetUrl());
EXPECT_NE(copyOperation.GetRawResponse(), nullptr);
EXPECT_EQ(
copyOperation.GetRawResponse().GetStatusCode(),
Azure::Core::Http::HttpStatusCode::Accepted);
EXPECT_FALSE(copyOperation.RequestId.empty());
EXPECT_TRUE(copyOperation.ETag.HasValue());
EXPECT_TRUE(IsValidTime(copyOperation.LastModified));