Skip to content

Commit

Permalink
handle instances where caseless is not defined on response
Browse files Browse the repository at this point in the history
  • Loading branch information
olingern committed Jan 27, 2020
1 parent 64efa3c commit 208e40a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/util/request-manager.js
Expand Up @@ -433,11 +433,9 @@ export default class RequestManager {
}
}

const server = res.caseless.get('server');

if (res.statusCode === 401 && server === 'GitHub.com') {
if (res.statusCode === 401 && res.caseless && res.caseless.get('server') === 'GitHub.com') {
const message = `${res.body.message}. If using GITHUB_TOKEN in your env, check that it is valid.`;
rejectWithoutUrl(new Error(this.reporter.lang('unauthorizedResponse', server, message)));
rejectWithoutUrl(new Error(this.reporter.lang('unauthorizedResponse', res.caseless.get('server'), message)));
}

if (res.statusCode === 401 && res.headers['www-authenticate']) {
Expand Down

0 comments on commit 208e40a

Please sign in to comment.