For the `request()` and `get()` functions. I could never
really understand why these two functions go through agent
first... Especially since the user could be passing `agent: false`
or a different Agent instance completely, in which `globalAgent`
will be completely bypassed.
Moved the relevant logic from `Agent#request()` into the
Incidentally, this commit fixes #7012 (which was the original
intent of this commit).
Between `ClientRequest` and `Agent`. The circular require was doing
weird things at load time, like making the `globalAgent` property
be `undefined` from within the context of the "_http_client"
Removing the circular dependency completely fixes this.
Otherwise the process would hang open on v0.10
(though on master the old test would pass successfully).
Also adding counter checks for both the server's
"request" event and the client's "response" event.