Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getUserAgent(options: ConnectionContextOptions): string {
const finalUserAgent = options.userAgent ? `${userAgent},${options.userAgent}` : userAgent;
if (finalUserAgent.length > Constants.maxUserAgentLength) {
throw new Error(
`The user-agent string cannot be more than ${Constants.maxUserAgentLength} characters in length.` +
`The given user-agent string is: ${finalUserAgent} with length: ${finalUserAgent.length}`
);
}
return finalUserAgent;
}
export function getUserAgent(options: ConnectionContextOptions): string {
const finalUserAgent = options.userAgent ? `${userAgent},${options.userAgent}` : userAgent;
if (finalUserAgent.length > Constants.maxUserAgentLength) {
throw new Error(
`The user-agent string cannot be more than ${Constants.maxUserAgentLength} characters in length.` +
`The given user-agent string is: ${finalUserAgent} with length: ${finalUserAgent.length}`
);
}
return finalUserAgent;
}