Skip to content

Commit f4d097a

Browse files
authored
Merge pull request #783 from AviVahl/replace-request-with-got
chore(deps): replace "request" with "got"
2 parents 87a00b7 + 495f7d8 commit f4d097a

File tree

3 files changed

+195
-364
lines changed

3 files changed

+195
-364
lines changed

lib/chrome-driver.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const ChildProcess = require('child_process');
22
const path = require('path');
3-
const request = require('request');
3+
const { default: got } = require('got');
44
const split = require('split');
55

66
function ChromeDriver(
@@ -122,16 +122,10 @@ ChromeDriver.prototype.stop = function () {
122122

123123
ChromeDriver.prototype.isRunning = function (callback) {
124124
const cb = false;
125-
const requestOptions = {
126-
uri: this.statusUrl,
127-
json: true,
128-
followAllRedirects: true
129-
};
130-
request(requestOptions, function (error, response, body) {
131-
if (error) return callback(cb);
132-
if (response.statusCode !== 200) return callback(cb);
133-
callback(body && body.value.ready);
134-
});
125+
got(this.statusUrl)
126+
.json()
127+
.then(({ value }) => callback(value && value.ready))
128+
.catch(() => callback(cb));
135129
};
136130

137131
ChromeDriver.prototype.getLogs = function () {

0 commit comments

Comments
 (0)