From 02c71320b4719b9d36ba2dd65693a75756ea3303 Mon Sep 17 00:00:00 2001 From: Ashutosh Ukey Date: Fri, 2 Dec 2022 15:09:11 -0500 Subject: [PATCH] fix: set user agent to pack ver (#47) --- src/generated/configuration.ts | 4 +++- templates/typescript-axios/configuration.mustache | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generated/configuration.ts b/src/generated/configuration.ts index e0b6641..a58894b 100644 --- a/src/generated/configuration.ts +++ b/src/generated/configuration.ts @@ -6,6 +6,8 @@ * Do not edit the class manually. */ +const packageJson = require("../../package.json"); + export interface ConfigurationParameters { apiKey?: | string @@ -60,7 +62,7 @@ export class Configuration { if (!this.baseOptions) this.baseOptions = {}; if (!this.baseOptions.headers) this.baseOptions.headers = {}; this.baseOptions.headers = { - ["User-Agent"]: `CircleNodeJs/1.2.0`, + ["User-Agent"]: `CircleNodeJs/${packageJson.version}`, ...this.baseOptions.headers }; } diff --git a/templates/typescript-axios/configuration.mustache b/templates/typescript-axios/configuration.mustache index 4cbadce..4f8b8b9 100644 --- a/templates/typescript-axios/configuration.mustache +++ b/templates/typescript-axios/configuration.mustache @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ {{>licenseInfo}} +const packageJson = require('../../package.json') export interface ConfigurationParameters { apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); @@ -49,7 +50,7 @@ export class Configuration { if (!this.baseOptions) this.baseOptions = {}; if (!this.baseOptions.headers) this.baseOptions.headers = {}; this.baseOptions.headers = { - ['User-Agent']: `CircleNodeJs/{{npmVersion}}`, + ['User-Agent']: `CircleNodeJs/${packageJson.version}`, ...this.baseOptions.headers, } }