From 978b1453e0772e57ebd8ff51541e97c8ff38af93 Mon Sep 17 00:00:00 2001 From: hwfqb Date: Tue, 26 Aug 2025 00:11:37 +0800 Subject: [PATCH] cache appProvisionType for http Signed-off-by: hwfqb --- frameworks/js/napi/http/http_exec/src/http_utils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frameworks/js/napi/http/http_exec/src/http_utils.cpp b/frameworks/js/napi/http/http_exec/src/http_utils.cpp index f789630c8..752e0b1a6 100644 --- a/frameworks/js/napi/http/http_exec/src/http_utils.cpp +++ b/frameworks/js/napi/http/http_exec/src/http_utils.cpp @@ -23,9 +23,15 @@ #endif namespace OHOS::NetStack::HttpUtils { + +static std::string g_appMode = ""; + bool IsDebugMode() { #if HAS_NETMANAGER_BASE + if (!g_appMode.empty()) { + return (g_appMode == "debug") ? true : false; + } sptr systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (systemAbilityManager == nullptr) { @@ -51,6 +57,7 @@ bool IsDebugMode() NETSTACK_LOGI("IsDebugMode GetBundleInfoForSelf res = %{public}d", res); const auto appProvisionType = bundleInfo.applicationInfo.appProvisionType; + g_appMode = appProvisionType; NETSTACK_LOGI("IsDebugMode appProvisionType = %{public}s", appProvisionType.c_str()); return (appProvisionType == "debug") ? true : false; #else -- Gitee