summaryrefslogtreecommitdiff
path: root/doc/api/modules.md
diff options
context:
space:
mode:
authorRoy Sommer <roy@sommer.co.il>2018-12-21 20:17:15 +0200
committerAnna Henningsen <anna@addaleax.net>2019-01-08 00:10:36 +0100
commit5774688e2614ccb89749ea2f523014c6479616aa (patch)
tree02952970058f8610d0c6cc91ac892fcf2e5e982c /doc/api/modules.md
parent309e7723eac0442972bbaa6a725366b8ab150892 (diff)
downloadandroid-node-v8-5774688e2614ccb89749ea2f523014c6479616aa.tar.gz
android-node-v8-5774688e2614ccb89749ea2f523014c6479616aa.tar.bz2
android-node-v8-5774688e2614ccb89749ea2f523014c6479616aa.zip
lib: support overriding http\s.globalAgent
Overriding `require('http[s]').globalAgent` is now respected by consequent requests. In order to achieve that, the following changes were made: 1. Implmentation in `http`: `module.exports.globalAgent` is now defined through `Object.defineProperty`. Its getter and setter return \ set `require('_http_agent').globalAgent`. 2. Implementation in `https`: the https `globalAgent` is not the same as `_http_agent`, and is defined in `https` module itself. Therefore, the fix here was to simply use `module.exports.globalAgent` to support mutation. 3. According tests were added for both `http` and `https`, where in both we create a server, set the default agent to a newly created instance and make a request to that server. We then assert that the given instance was actually used by inspecting its sockets property. Fixes: https://github.com/nodejs/node/issues/23281 PR-URL: https://github.com/nodejs/node/pull/25170 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/modules.md')
0 files changed, 0 insertions, 0 deletions