Skip to content

Commit 7029359

Browse files
committed
feat: added sdk version to header
1 parent 9540eab commit 7029359

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/core/request.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
44
import { defaultsDeep } from 'lodash';
55
import { MyTonSwapResponse } from '../types/client';
66
import { defaultBaseUrl } from '../constants';
7+
import packageJson from '../../package.json';
78
export class Request {
89
attemptOptions: Partial<AttemptOptions<any>> = {
910
maxAttempts: 3,
@@ -21,7 +22,8 @@ export class Request {
2122
...(this.client.options?.apiKey && {
2223
'x-api-key': this.client.options.apiKey,
2324
}),
24-
...this.client.options?.headers,
25+
...(this.client.options?.headers ?? {}),
26+
'sdk-version': packageJson.version,
2527
},
2628
method: 'GET',
2729
} satisfies AxiosRequestConfig;

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"noImplicitAny": true,
1818
"esModuleInterop": true,
1919
"strictNullChecks": true,
20+
"resolveJsonModule": true,
2021

2122
// Best practices
2223
"strict": true,

0 commit comments

Comments
 (0)