Skip to content

Commit ccf10c6

Browse files
Merge pull request #45 from brendandburns/master
Add some defensive code if `headers` is null.
2 parents 7b21c7e + 69d615d commit ccf10c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

node-client/src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ export class KubeConfig {
160160
}
161161

162162
if (token) {
163+
if (!opts.headers) {
164+
opts.headers = [];
165+
}
163166
opts.headers['Authorization'] = token;
164167
}
165168
}
@@ -239,6 +242,9 @@ export class Config {
239242
k8sApi.setDefaultAuthentication({
240243
'applyToRequest': (opts) => {
241244
opts.ca = caCert;
245+
if (!opts.headers) {
246+
opts.headers = [];
247+
}
242248
opts.headers['Authorization'] = 'Bearer ' + token;
243249
}
244250
});

0 commit comments

Comments
 (0)