You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
477 B
15 lines
477 B
4 weeks ago
|
import platform from 'platform';
|
||
|
import pkg from '../../browser/version';
|
||
|
import { checkUserAgent } from './checkUserAgent';
|
||
|
|
||
|
export const getUserAgent = () => {
|
||
|
const agent = process && process.browser ? 'js' : 'nodejs';
|
||
|
const sdk = `aliyun-sdk-${agent}/${pkg.version}`;
|
||
|
let plat = platform.description;
|
||
|
if (!plat && process) {
|
||
|
plat = `Node.js ${process.version.slice(1)} on ${process.platform} ${process.arch}`;
|
||
|
}
|
||
|
|
||
|
return checkUserAgent(`${sdk} ${plat}`);
|
||
|
};
|