From 1ded535b50f6c574a8fd80598e290fde957a7b17 Mon Sep 17 00:00:00 2001 From: Ujjwal Soni Date: Mon, 30 Dec 2024 10:28:53 +0530 Subject: [PATCH] Minor change in userAgentDetails() function (#32372) ### Packages impacted by this PR @azure/cosmos ### Issues associated with this PR ### Describe the problem that is addressed by this PR ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary) --- sdk/cosmosdb/cosmos/src/common/platform.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/cosmosdb/cosmos/src/common/platform.ts b/sdk/cosmosdb/cosmos/src/common/platform.ts index d7756ff2afab..be315c1c3077 100644 --- a/sdk/cosmosdb/cosmos/src/common/platform.ts +++ b/sdk/cosmosdb/cosmos/src/common/platform.ts @@ -16,13 +16,15 @@ export function getUserAgent(suffix?: string): string { // TODO: Standardize across other platforms from @azure/core-util function userAgentDetails(): string { + let userAgentDetail = ""; + if (globalThis.navigator && globalThis.navigator.userAgent) { - return globalThis.navigator.userAgent; + userAgentDetail = globalThis.navigator.userAgent; } if (globalThis.process && globalThis.process.version) { - return `Node.js/${process.version.slice(1)} (${process.platform}; ${process.arch})`; + userAgentDetail = `Node.js/${process.version.slice(1)} (${process.platform}; ${process.arch})`; } - return ""; + return userAgentDetail; }