Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 58d4689

Browse files
author
Daniel Climent
committed
Add more system details to userAgent
1 parent 2585b65 commit 58d4689

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/index.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@ import pWaitFor from 'p-wait-for'
33
import { getMethods } from './methods/index.js'
44
import { openApiSpec } from './open_api.js'
55
import { getOperations } from './operations.js'
6+
import { version } from './package.json';
67

78
export class NetlifyAPI {
89
constructor(firstArg, secondArg) {
910
// variadic arguments
1011
const [accessTokenInput, opts = {}] = typeof firstArg === 'object' ? [null, firstArg] : [firstArg, secondArg]
1112

13+
const nodeVersion = process.version
14+
15+
var systemOS = process.platform;
16+
if systemOS == "darwin" {
17+
systemOS = "MacOS"
18+
} else if systemOS == "win32" || systemOS == "win64" {
19+
systemOS = "Winodws"
20+
}
21+
1222
// default opts
1323
const {
14-
userAgent = 'netlify/js-client',
24+
userAgent = `netlify/js-client ${version}; nodejs version ${nodeVersion}; OS: ${systemOS}`,
1525
scheme = openApiSpec.schemes[0],
1626
host = openApiSpec.host,
1727
pathPrefix = openApiSpec.basePath,

0 commit comments

Comments
 (0)