Skip to content

Commit c2e528a

Browse files
authored
Merge pull request #165 from xmtp/revert-version-changes
Remove version altogether
2 parents 0aec0e0 + b73f969 commit c2e528a

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

src/ApiClient.ts

-12
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ import { retry, sleep } from './utils'
44
import Long from 'long'
55
import AuthCache from './authn/AuthCache'
66
import { Authenticator } from './authn'
7-
import { version } from '../package.json'
87
export const { MessageApi, SortDirection } = messageApi
98

109
const RETRY_SLEEP_TIME = 100
1110
const ERR_CODE_UNAUTHENTICATED = 16
1211

13-
const clientVersionHeaderKey = 'X-Client-Version'
14-
1512
export type GrpcError = Error & { code?: number }
1613

1714
export type QueryParams = {
@@ -80,12 +77,10 @@ export default class ApiClient {
8077
pathPrefix: string
8178
maxRetries: number
8279
private authCache?: AuthCache
83-
version: string
8480

8581
constructor(pathPrefix: string, opts?: ApiClientOptions) {
8682
this.pathPrefix = pathPrefix
8783
this.maxRetries = opts?.maxRetries || 5
88-
this.version = 'xmtp-js/' + version
8984
}
9085

9186
// Raw method for querying the API
@@ -99,9 +94,6 @@ export default class ApiClient {
9994
{
10095
pathPrefix: this.pathPrefix,
10196
mode: 'cors',
102-
headers: new Headers({
103-
[clientVersionHeaderKey]: this.version,
104-
}),
10597
},
10698
],
10799
this.maxRetries,
@@ -125,7 +117,6 @@ export default class ApiClient {
125117
mode: 'cors',
126118
headers: new Headers({
127119
Authorization: `Bearer ${authToken}`,
128-
[clientVersionHeaderKey]: this.version,
129120
}),
130121
},
131122
],
@@ -160,9 +151,6 @@ export default class ApiClient {
160151
pathPrefix: this.pathPrefix,
161152
signal: abortController.signal,
162153
mode: 'cors',
163-
headers: new Headers({
164-
[clientVersionHeaderKey]: this.version,
165-
}),
166154
}).catch(async (err: GrpcError) => {
167155
if (isAbortError(err)) {
168156
return

test/ApiClient.test.ts

-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Long from 'long'
55
import { sleep } from './helpers'
66
import { Authenticator } from '../src/authn'
77
import { PrivateKey } from '../src'
8-
import { version } from '../package.json'
98
const { MessageApi } = messageApi
109

1110
const PATH_PREFIX = 'http://fake:5050'
@@ -52,9 +51,6 @@ describe('Query', () => {
5251
expect(apiMock).toHaveBeenCalledWith(expectedReq, {
5352
pathPrefix: PATH_PREFIX,
5453
mode: 'cors',
55-
headers: new Headers({
56-
'X-Client-Version': 'xmtp-js/' + version,
57-
}),
5854
})
5955
})
6056

@@ -103,9 +99,6 @@ describe('Query', () => {
10399
expect(apiMock).toHaveBeenCalledWith(expectedReq, {
104100
pathPrefix: PATH_PREFIX,
105101
mode: 'cors',
106-
headers: new Headers({
107-
'X-Client-Version': 'xmtp-js/' + version,
108-
}),
109102
})
110103
})
111104

@@ -131,9 +124,6 @@ describe('Query', () => {
131124
expect(apiMock).toHaveBeenLastCalledWith(expectedReq, {
132125
pathPrefix: PATH_PREFIX,
133126
mode: 'cors',
134-
headers: new Headers({
135-
'X-Client-Version': 'xmtp-js/' + version,
136-
}),
137127
})
138128
})
139129
})
@@ -176,7 +166,6 @@ describe('Publish', () => {
176166
mode: 'cors',
177167
headers: new Headers({
178168
Authorization: `Bearer ${AUTH_TOKEN}`,
179-
'X-Client-Version': 'xmtp-js/' + version,
180169
}),
181170
})
182171
})
@@ -250,9 +239,6 @@ describe('Subscribe', () => {
250239
pathPrefix: PATH_PREFIX,
251240
signal: expect.anything(),
252241
mode: 'cors',
253-
headers: new Headers({
254-
'X-Client-Version': 'xmtp-js/' + version,
255-
}),
256242
})
257243
})
258244

0 commit comments

Comments
 (0)