Thanks for reading my bug report, I'm new to this library and this was a tough one to track down based on the test failures I was seeing in my app.
Description
When an intercepted request is not handled (interceptor.on('request'...) and the request uses a custom HTTP Agent, the custom agent's createConnection method is bound to the MockHttpAgent's this context instead of the custom agent's this context, so methods/local variables are unavailable causing an exception.
Steps to Reproduce
Create a Custom Agent
Implement createConnection and have it reference something else within itself (in my example, this._noop().
Thanks for reading my bug report, I'm new to this library and this was a tough one to track down based on the test failures I was seeing in my app.
Description
When an intercepted request is not handled (
interceptor.on('request'...
) and the request uses a custom HTTP Agent, the custom agent'screateConnection
method is bound to theMockHttpAgent
'sthis
context instead of the custom agent'sthis
context, so methods/local variables are unavailable causing an exception.Steps to Reproduce
createConnection
and have it reference something else within itself (in my example,this._noop()
.Repro Links
Location of Bug
MockAgent
Specifically, it binds the
this
context of theMockAgent
instead of thethis
of thecustomAgent
.Additional question
Only the
createConnection
are bound from the custom agent, should the other methods from the custom agent be used?