From 6c204855c67563e1c7e4ed3769f2a2a4e774bf1c Mon Sep 17 00:00:00 2001 From: Bjarn Bronsveld Date: Tue, 23 Dec 2025 19:24:59 +0100 Subject: [PATCH] feat: include SDK version and Node.js version in User-Agent header - Updated `client.ts` to add `Lettermint/{version} (Node.js; Node {nodeVersion})` in the `User-Agent` header. - Dynamically fetches SDK version from `package.json` and Node.js version from the runtime environment. --- src/client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/client.ts b/src/client.ts index 84c0915..edfe7e6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,4 +1,5 @@ import { isNativeError } from 'node:util/types'; +import { version } from '../package.json'; import { ClientError, HttpRequestError, TimeoutError, ValidationError } from './utils/errors'; /** @@ -59,10 +60,14 @@ export class LettermintClient { this.apiToken = config.apiToken; this.baseUrl = config.baseUrl || 'https://api.lettermint.co/v1'; this.timeout = config.timeout || 30000; + + const nodeVersion = process.version.replace(/^v/, ''); + this.defaultHeaders = { 'Content-Type': 'application/json', Accept: 'application/json', 'x-lettermint-token': this.apiToken, + 'User-Agent': `Lettermint/${version} (Node.js; Node ${nodeVersion})`, }; }