Created by: coderarity
This is just a simplification of the code really - I removed a lot of code that was just pretty much a copy of stream.pipe
, and used stream.pipe
instead.
I also removed a test that caused a bunch of subsequent tests to fail. The reasoning for this removal was that the test shouldn't pass. In the case that it was testing, it was aborting the connection, which in turn caused the proxy to abort the connection. Since this happened before the target server received any data, the test would hang, waiting for the connection to be made. http.request
didn't send the data since it was aborted too early. The only way I can think of fixing this is to abort the request (without this other tests would fail), and then send a 'dummy' request so that the test passes. Since this is obviously the inappropriate behavior, and since I wanted to be able to use the subsequent tests, I removed the test in this pull request.
This leaves one more test that doesn't pass. This isn't any different from the master branch - a test is failing because the connection object has a circular reference, and assert.equal uses JSON.stringify
. I'm not sure why the connection object has a circular reference, and if this is because of inaccurate behavior, so I left it alone.