Skip to content

Commit

Permalink
Merge branch 'master' into remove-old-hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmywarting authored Jan 2, 2022
2 parents c1ea82b + 048cf18 commit 2d686df
Show file tree
Hide file tree
Showing 57 changed files with 4,673 additions and 4,352 deletions.
4 changes: 2 additions & 2 deletions examples/simple-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const request = require('..');
const url =
'https://gist.githubusercontent.com/reinaldo13/cdbb4d663ba23410a77b/raw/0345267767d50790051951ddc460e2699649de2b/it-works.txt';

request.get(url, (err, res) => {
if (err) throw err;
request.get(url, (error, res) => {
if (error) throw error;
console.log(res.text);
});
130 changes: 66 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,54 @@
],
"dependencies": {
"component-emitter": "^1.3.0",
"cookiejar": "^2.1.2",
"debug": "^4.3.1",
"fast-safe-stringify": "^2.0.7",
"cookiejar": "^2.1.3",
"debug": "^4.3.3",
"fast-safe-stringify": "^2.1.1",
"form-data": "^4.0.0",
"formidable": "^1.2.2",
"formidable": "^2.0.1",
"methods": "^1.1.2",
"mime": "^2.5.0",
"qs": "^6.9.6",
"qs": "^6.10.1",
"readable-stream": "^3.6.0",
"semver": "^7.3.4"
"semver": "^7.3.5"
},
"devDependencies": {
"@babel/cli": "^7.12.16",
"@babel/core": "^7.12.16",
"@babel/plugin-transform-runtime": "^7.12.15",
"@babel/preset-env": "^7.12.16",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/preset-env": "^7.16.4",
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"Base64": "^1.1.0",
"babelify": "^10.0.0",
"basic-auth-connect": "^1.0.0",
"body-parser": "^1.19.0",
"browserify": "^17.0.0",
"codecov": "^3.8.1",
"cookie-parser": "^1.4.5",
"codecov": "^3.8.3",
"cookie-parser": "^1.4.6",
"cross-env": "^7.0.3",
"eslint": "^7.20.0",
"eslint-config-xo-lass": "^1.0.5",
"eslint-plugin-compat": "^3.9.0",
"eslint": "^8.3.0",
"eslint-config-xo-lass": "^1.0.6",
"eslint-plugin-compat": "^4.0.0",
"eslint-plugin-node": "^11.1.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"express-session": "^1.17.2",
"fixpack": "^4.0.0",
"husky": "^5.0.9",
"lint-staged": "^10.5.4",
"husky": "^7.0.4",
"lint-staged": "^12.1.2",
"marked": "^2.0.0",
"mocha": "3.5.3",
"multer": "^1.4.2",
"multer": "^1.4.3",
"nyc": "^15.1.0",
"remark-cli": "^9.0.0",
"remark-cli": "^10.0.1",
"remark-preset-github": "^4.0.1",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"should-http": "^0.1.1",
"tinyify": "^3.0.0",
"xo": "0.37.1",
"xo": "^0.47.0",
"zuul": "^3.12.0"
},
"engines": {
"node": ">= 7.0.0"
},
"homepage": "https://github.com/visionmedia/superagent",
"husky": {
"hooks": {
Expand Down Expand Up @@ -178,48 +175,53 @@
"mocha"
],
"rules": {
"block-scoped-var": "off",
"complexity": "off",
"default-case": "off",
"eqeqeq": "off",
"func-name-matching": "off",
"func-names": "off",
"guard-for-in": "off",
"handle-callback-err": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unassigned-import": "off",
"import/order": "off",
"max-nested-callbacks": "off",
"new-cap": "off",
"no-eq-null": "off",
"no-extend-native": "off",
"no-implicit-coercion": "off",
"no-multi-assign": "off",
"no-negated-condition": "off",
"no-prototype-builtins": "off",
"no-redeclare": "off",
"no-undef": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"no-use-extend-native/no-use-extend-native": "off",
"no-useless-escape": "off",
"no-var": "off",
"no-void": "off",
"node/no-deprecated-api": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"promise/prefer-await-to-then": "off",
"promise/valid-params": "off",
"unicorn/filename-case": "off",
"valid-jsdoc": "off",
"node/no-unsupported-features/node-builtins": "off",
"node/no-path-concat": "off"
"block-scoped-var": "warn",
"complexity": "warn",
"default-case": "warn",
"eqeqeq": "warn",
"func-name-matching": "warn",
"func-names": "warn",
"guard-for-in": "warn",
"handle-callback-err": "warn",
"import/no-extraneous-dependencies": "warn",
"import/no-unassigned-import": "warn",
"import/order": "warn",
"max-nested-callbacks": "warn",
"new-cap": "warn",
"no-eq-null": "warn",
"no-extend-native": "warn",
"no-implicit-coercion": "warn",
"no-multi-assign": "warn",
"no-negated-condition": "warn",
"no-prototype-builtins": "warn",
"no-redeclare": "warn",
"no-undef": "warn",
"no-unused-expressions": "warn",
"no-unused-vars": "warn",
"no-use-extend-native/no-use-extend-native": "warn",
"no-useless-escape": "warn",
"no-var": "warn",
"no-void": "warn",
"node/no-deprecated-api": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"unicorn/filename-case": "warn",
"valid-jsdoc": "warn",
"node/no-path-concat": "warn",
"unicorn/no-empty-file": "warn"
}
}
],
"rules": {
"unicorn/prevent-abbreviations": "off",
"node/no-unsupported-features/es-syntax": "off"
"unicorn/prevent-abbreviations": "warn",
"no-bitwise": "warn",
"node/prefer-global/buffer": "warn",
"node/prefer-global/process": "warn",
"unicorn/no-new-array": "warn",
"unicorn/no-this-assignment": "warn",
"unicorn/prefer-spread": "warn",
"unicorn/catch-error-name": "warn",
"unicorn/prefer-code-point": "warn"
}
}
}
14 changes: 7 additions & 7 deletions src/agent-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function Agent() {
this._defaults = [];
}

[
for (const fn of [
'use',
'on',
'once',
Expand All @@ -25,18 +25,18 @@ function Agent() {
'pfx',
'cert',
'disableTLSCerts'
].forEach((fn) => {
]) {
// Default setting for all requests from this agent
Agent.prototype[fn] = function (...args) {
this._defaults.push({ fn, args });
return this;
};
});
}

Agent.prototype._setDefaults = function (req) {
this._defaults.forEach((def) => {
req[def.fn](...def.args);
});
Agent.prototype._setDefaults = function (request) {
for (const def of this._defaults) {
request[def.fn](...def.args);
}
};

module.exports = Agent;
Loading

0 comments on commit 2d686df

Please sign in to comment.