Skip to content

Commit

Permalink
Merge pull request #45 from brendandburns/master
Browse files Browse the repository at this point in the history
Add some defensive code if `headers` is null.
  • Loading branch information
mattstern31 committed Apr 28, 2018
2 parents 04a526c + 5bed172 commit 9f0f2ea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions node-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export class KubeConfig {
}

if (token) {
if (!opts.headers) {
opts.headers = [];
}
opts.headers['Authorization'] = token;
}
}
Expand Down Expand Up @@ -239,6 +242,9 @@ export class Config {
k8sApi.setDefaultAuthentication({
'applyToRequest': (opts) => {
opts.ca = caCert;
if (!opts.headers) {
opts.headers = [];
}
opts.headers['Authorization'] = 'Bearer ' + token;
}
});
Expand Down

0 comments on commit 9f0f2ea

Please sign in to comment.