Skip to content

Commit c46ee86

Browse files
Merge pull request #99 from terminusdb/addUAHeader
added user agent header
2 parents 7aeec27 + 1e0be49 commit c46ee86

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/dispatchRequest.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const axiosInstance = require('./axiosInstance')
22
const UTILS = require('./utils.js')
33
const CONST = require('./const.js')
44
const ErrorMessage = require('./errorMessage')
5-
5+
const { version } = require('../package.json')
66
/**
77
* base 64 encodes a string using either the btoa implementation if available or the Buffer object.
88
* @param {String} str string to be base 64 encoded
@@ -77,6 +77,11 @@ function DispatchRequest(url, action, payload, local_auth, remote_auth = null, c
7777
options.headers[key] = customHeaders[key]
7878
})
7979
}
80+
81+
if(typeof window === 'undefined') {
82+
options.headers['User-Agent'] = 'terminusdb-client-js/'+version;
83+
}
84+
8085
switch (action) {
8186
case CONST.DELETE:
8287
if (payload) {

0 commit comments

Comments
 (0)