From ef08c7a6c61c0bf597270506855aaf5798a15d56 Mon Sep 17 00:00:00 2001 From: strausr Date: Mon, 11 Oct 2021 08:49:02 +0300 Subject: [PATCH] Add node version to user agent (#519) --- lib-es5/utils/index.js | 2 +- lib/utils/index.js | 2 +- test/unit/cloudinaryUtils/getUserAgent.spec.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib-es5/utils/index.js b/lib-es5/utils/index.js index 910355a8..3f70ea63 100644 --- a/lib-es5/utils/index.js +++ b/lib-es5/utils/index.js @@ -80,7 +80,7 @@ exports.CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net"; exports.OLD_AKAMAI_SHARED_CDN = "cloudinary-a.akamaihd.net"; exports.AKAMAI_SHARED_CDN = "res.cloudinary.com"; exports.SHARED_CDN = exports.AKAMAI_SHARED_CDN; -exports.USER_AGENT = `CloudinaryNodeJS/${exports.VERSION}`; +exports.USER_AGENT = `CloudinaryNodeJS/${exports.VERSION} (Node ${process.versions.node})`; // Add platform information to the USER_AGENT header // This is intended for platform information and not individual applications! diff --git a/lib/utils/index.js b/lib/utils/index.js index 55caa249..f3881968 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -66,7 +66,7 @@ exports.CF_SHARED_CDN = "d3jpl91pxevbkh.cloudfront.net"; exports.OLD_AKAMAI_SHARED_CDN = "cloudinary-a.akamaihd.net"; exports.AKAMAI_SHARED_CDN = "res.cloudinary.com"; exports.SHARED_CDN = exports.AKAMAI_SHARED_CDN; -exports.USER_AGENT = `CloudinaryNodeJS/${exports.VERSION}`; +exports.USER_AGENT = `CloudinaryNodeJS/${exports.VERSION} (Node ${process.versions.node})`; // Add platform information to the USER_AGENT header // This is intended for platform information and not individual applications! diff --git a/test/unit/cloudinaryUtils/getUserAgent.spec.js b/test/unit/cloudinaryUtils/getUserAgent.spec.js index 6f619c24..dc33af72 100644 --- a/test/unit/cloudinaryUtils/getUserAgent.spec.js +++ b/test/unit/cloudinaryUtils/getUserAgent.spec.js @@ -12,6 +12,6 @@ describe("getUserAgent", function () { }); it("should add a user platform to USER_AGENT", function () { cloudinary.utils.userPlatform = "Spec/1.0 (Test)"; - expect(cloudinary.utils.getUserAgent()).to.match(/Spec\/1.0 \(Test\) CloudinaryNodeJS\/[\d.]+/); + expect(cloudinary.utils.getUserAgent()).to.match(/Spec\/1.0 \(Test\) CloudinaryNodeJS\/[\d.]+ \(Node [\d.]+\)/); }); });