Skip to content

Commit

Permalink
fix: use existing convention for sdk name (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Jan 21, 2025
1 parent b558693 commit e26a700
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const buildHeaders = ({
head['Unleash-Client-Spec'] = specVersionSupported;
}
const version = details.version;
head['x-unleash-sdk'] = `unleash-node@${version}`;
head['x-unleash-sdk'] = `unleash-client-node:${version}`;
if (custom) {
Object.assign(head, custom);
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ test('should send correct custom and x-unleash headers', (t) =>
const metricsEP = nockMetrics(url)
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', 'appName')
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.matchHeader('x-unleash-sdk', /^unleash-client-node:\d+\.\d+\.\d+/)
.matchHeader('x-unleash-connection-id', 'connectionId');
const regEP = nockRegister(url)
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', 'appName')
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.matchHeader('x-unleash-sdk', /^unleash-client-node:\d+\.\d+\.\d+/)
.matchHeader('x-unleash-connection-id', 'connectionId');

// @ts-expect-error
Expand Down
2 changes: 1 addition & 1 deletion src/test/repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ test('should request with correct custom and x-unleash headers', (t) =>
.matchHeader('randomKey', randomKey)
.matchHeader('x-unleash-appname', appName)
.matchHeader('x-unleash-connection-id', connectionId)
.matchHeader('x-unleash-sdk', /^unleash-node@\d+\.\d+\.\d+/)
.matchHeader('x-unleash-sdk', /^unleash-client-node:\d+\.\d+\.\d+/)
.persist()
.get('/client/features')
.reply(200, { features: [] }, { Etag: '12345-3' });
Expand Down
2 changes: 1 addition & 1 deletion src/test/request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ test('Correct headers should be included', (t) => {
t.is(headers['UNLEASH-INSTANCEID'], 'instanceId');
t.is(headers['x-unleash-connection-id'], 'connectionId');
t.is(headers['x-unleash-appname'], 'myApp');
t.regex(headers['x-unleash-sdk'], /^unleash-node@\d+\.\d+\.\d+/);
t.regex(headers['x-unleash-sdk'], /^unleash-client-node:\d+\.\d+\.\d+/);
});

0 comments on commit e26a700

Please sign in to comment.