We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eab3af2 commit b4d8f00Copy full SHA for b4d8f00
src/ApiClient.js
@@ -64,7 +64,10 @@
64
* @type {Array.<String>}
65
* @default {}
66
*/
67
- this.defaultHeaders = {};
+ const pkgJson = require('../package.json');
68
+ this.defaultHeaders = {
69
+ 'user-agent': `sendinblue_clientAPI/v${pkgJson.version}/node`
70
+ };
71
72
/**
73
* The default HTTP timeout for all API calls.
@@ -578,6 +581,13 @@
578
581
}
579
582
};
580
583
584
+ exports.setUserAgent = function(header) {
585
+ if (typeof header == 'string' && header.substr(0,11).trim().toLowerCase() === 'sendinblue_') {
586
+ exports.instance.defaultHeaders['user-agent'] = header;
587
+ }
588
+ return;
589
590
+
591
592
* The default API client implementation.
593
* @type {module:ApiClient}
0 commit comments