diff --git a/sdk/core/azure-core/inc/azure/core/operation.hpp b/sdk/core/azure-core/inc/azure/core/operation.hpp index e9567a7ad..cfd3c32f4 100644 --- a/sdk/core/azure-core/inc/azure/core/operation.hpp +++ b/sdk/core/azure-core/inc/azure/core/operation.hpp @@ -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. diff --git a/sdk/core/azure-core/inc/azure/core/response.hpp b/sdk/core/azure-core/inc/azure/core/response.hpp index 760b5c5d6..759c40c3c 100644 --- a/sdk/core/azure-core/inc/azure/core/response.hpp +++ b/sdk/core/azure-core/inc/azure/core/response.hpp @@ -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) diff --git a/sdk/core/azure-core/test/ut/operation_test.hpp b/sdk/core/azure-core/test/ut/operation_test.hpp index 08c38a4b4..8e035d9b5 100644 --- a/sdk/core/azure-core/test/ut/operation_test.hpp +++ b/sdk/core/azure-core/test/ut/operation_test.hpp @@ -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; } diff --git a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp index e6786229f..237514682 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp +++ b/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/delete_key_operation.hpp @@ -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. diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp index 81ec3703b..3be8e5f78 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp @@ -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; diff --git a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp index 566f37eed..398c7c795 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp @@ -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)); diff --git a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp index 74013fea9..7870d881b 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp @@ -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)); diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp index 5c60c3d90..30c94d46b 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp @@ -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; diff --git a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp index 005a946f6..0a2ad117c 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp @@ -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));