diff --git a/package.json b/package.json index a76a2cf0..933fbc55 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,7 @@ "browser": { "./src/node/index.js": "./src/client.js", "./lib/node/index.js": "./lib/client.js", - "./test/support/server.js": "./test/support/blank.js", - "re2": false + "./test/support/server.js": "./test/support/blank.js" }, "bugs": { "url": "https://github.com/ladjs/superagent/issues" @@ -27,8 +26,7 @@ "formidable": "^3.5.1", "methods": "^1.1.2", "mime": "2.6.0", - "qs": "^6.11.0", - "re2": "^1.21.3" + "qs": "^6.11.0" }, "devDependencies": { "@babel/cli": "^7.20.7", diff --git a/src/utils.js b/src/utils.js index fc3514cc..fc1314c1 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,14 +1,3 @@ -let RE2; -let hasRE2 = true; - -try { - RE2 = require('re2'); -} catch { - hasRE2 = false; -} - -const SafeRegExp = hasRE2 ? RE2 : RegExp; - /** * Return the mime type for the given `str`. @@ -125,7 +114,7 @@ exports.mixin = (target, source) => { */ exports.isGzipOrDeflateEncoding = (res) => { - return new SafeRegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']); + return new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']); }; /** @@ -135,5 +124,5 @@ exports.isGzipOrDeflateEncoding = (res) => { */ exports.isBrotliEncoding = (res) => { - return new SafeRegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']); + return new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']); };