Skip to content

Commit 9551215

Browse files
authored
fix: can overwrite sdk header (#709)
1 parent 165ea52 commit 9551215

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/request.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,18 @@ export const buildHeaders = ({
9696
if (specVersionSupported) {
9797
head['Unleash-Client-Spec'] = specVersionSupported;
9898
}
99+
100+
const version = details.version;
101+
head['unleash-sdk'] = `unleash-client-node:${version}`;
102+
99103
if (custom) {
100104
Object.assign(head, custom);
101105
}
102106
// unleash-connection-id and unleash-sdk should not be overwritten
103107
if (connectionId) {
104108
head['unleash-connection-id'] = connectionId;
105109
}
106-
const version = details.version;
107-
head['unleash-sdk'] = `unleash-client-node:${version}`;
110+
108111
return head;
109112
};
110113

src/test/repository.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ test('should request with correct custom and unleash headers', (t) =>
207207
storageProvider: new InMemStorageProvider(),
208208
headers: {
209209
randomKey,
210-
'unleash-sdk': 'ignore',
211210
'unleash-connection-id': 'ignore',
212211
},
213212
});

0 commit comments

Comments
 (0)