From f6dce14f2eb7e86a2ae76494f2734019352ac037 Mon Sep 17 00:00:00 2001 From: Elliot-xq Date: Thu, 2 May 2024 22:00:25 +0000 Subject: [PATCH] fix the format for api key uid --- src/api_proxy/service_control/request_builder.cc | 4 ++-- src/api_proxy/service_control/request_builder_test.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api_proxy/service_control/request_builder.cc b/src/api_proxy/service_control/request_builder.cc index 844f168d..345c5617 100644 --- a/src/api_proxy/service_control/request_builder.cc +++ b/src/api_proxy/service_control/request_builder.cc @@ -388,8 +388,8 @@ Status set_credential_id(const SupportedLabel& l, const ReportRequestInfo& info, if (info.check_response_info.error.is_network_error) { (*labels)[l.name] = absl::StrCat(kApiKeyPrefix, "UNKNOWN"); } else { - (*labels)[l.name] = absl::StrCat(kApiKeyPrefix, info.check_response_info.api_key_uid.empty() ? info.api_key - : info.check_response_info.api_key_uid); + (*labels)[l.name] = info.check_response_info.api_key_uid.empty() ? absl::StrCat(kApiKeyPrefix, info.api_key) + : info.check_response_info.api_key_uid; } } else { (*labels)[l.name] = absl::StrCat(kApiKeyPrefix, info.api_key); diff --git a/src/api_proxy/service_control/request_builder_test.cc b/src/api_proxy/service_control/request_builder_test.cc index 4b626ca7..669af984 100644 --- a/src/api_proxy/service_control/request_builder_test.cc +++ b/src/api_proxy/service_control/request_builder_test.cc @@ -431,7 +431,7 @@ TEST_F(RequestBuilderTest, ReportApiKeyVerifiedWithApiKeyUIDTest) { FillOperationInfo(&info); info.check_response_info.api_key_state = api_key::ApiKeyState::VERIFIED; - info.check_response_info.api_key_uid = "fake_api_key_uid"; + info.check_response_info.api_key_uid = "apikey:fake_api_key_uid"; info.enable_api_key_uid_reporting = true; gasv1::ReportRequest request;