Skip to content

Commit

Permalink
log before adding agents - fixes issue #252 (#253)
Browse files Browse the repository at this point in the history
Co-authored-by: Glynn Bird <glynnbird@apache.org>
  • Loading branch information
glynnbird and Glynn Bird committed Jan 15, 2021
1 parent fb38c50 commit 1680101
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 26 deletions.
6 changes: 4 additions & 2 deletions lib/nano.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,6 @@ module.exports = exports = function dbScope (cfg) {
} else if (opts.dontParse) {
req.responseType = 'arraybuffer'
}
req.httpAgent = cfg.requestDefaults.agent || defaultHttpAgent
req.httpsAgent = cfg.requestDefaults.agent || defaultHttpsAgent

// scrub and log
const scrubbedReq = JSON.parse(JSON.stringify(req))
Expand All @@ -377,6 +375,10 @@ module.exports = exports = function dbScope (cfg) {
}
log(scrubbedReq)

// add http agents
req.httpAgent = cfg.requestDefaults.agent || defaultHttpAgent
req.httpsAgent = cfg.requestDefaults.agent || defaultHttpsAgent

// actually do the HTTP request
if (opts.stream) {
// return the Request object for streaming
Expand Down
51 changes: 28 additions & 23 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "Apache-2.0",
"homepage": "http://github.com/apache/couchdb-nano",
"repository": "http://github.com/apache/couchdb-nano",
"version": "9.0.2",
"version": "9.0.3",
"author": "Apache CouchDB <dev@couchdb.apache.org> (http://couchdb.apache.org)",
"keywords": [
"couchdb",
Expand All @@ -17,6 +17,7 @@
"database"
],
"dependencies": {
"@types/tough-cookie": "^4.0.0",
"axios": "^0.21.1",
"axios-cookiejar-support": "^1.0.1",
"qs": "^6.9.4",
Expand Down

0 comments on commit 1680101

Please sign in to comment.