Skip to content

Commit

Permalink
fix: set rejectUnauthorized=false in availability
Browse files Browse the repository at this point in the history
moving from request -> got
  • Loading branch information
ssmirr committed Feb 13, 2020
1 parent f15b21d commit f5d53e3
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 17 deletions.
19 changes: 6 additions & 13 deletions lib/inspect/checks/availability.js
@@ -1,4 +1,4 @@
const request = require('request');
const got = require('got');
const chalk = require('chalk');
const Check = require('./check');

Expand Down Expand Up @@ -33,18 +33,11 @@ class AvailabilityCheck extends Check {
}

async requestStatus(address) {
const self = this;
return new Promise(((resolve, reject) => {
request(address, { timeout: self.timeout }, (error, response, body) => {
if (!error && response.statusCode === 200) {
resolve(response.statusCode);
} else if (error && error.code) {
resolve(error.code);
} else {
resolve(error);
}
});
}));
try {
return (await got(address, {followRedirect: true, rejectUnauthorized: false, timeout: this.timeout})).statusCode;
} catch (err) {
return err.errorCode || err;
}
}

async report(results) {
Expand Down
213 changes: 210 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -28,9 +28,9 @@
"check-disk-space": "^2.0.0",
"dockerode": "^3.1.0",
"fs-extra": "^8.0.0",
"got": "^10.5.5",
"infra.connectors": "github:ottomatica/infra.connectors",
"js-yaml": "^3.12.0",
"request": "^2.88.2",
"semver": "^7.1.3",
"ssh2": "^0.8.2",
"systeminformation": "^4.21.2",
Expand Down

0 comments on commit f5d53e3

Please sign in to comment.