The 'connect' event should emit a ConnectEvent object.

This commit is contained in:
James Coglan
2015-07-07 21:33:15 +01:00
parent 4a3d51cc5b
commit 780dd331fe
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
var Stream = require('stream').Stream,
url = require('url'),
util = require('util'),
Base = require('./base'),
Headers = require('./headers'),
HttpParser = require('../http_parser');
@@ -69,7 +70,7 @@ var instance = {
this.headers = this._http.headers;
if (this.statusCode === 200) {
this.emit('connect');
this.emit('connect', new Base.ConnectEvent());
} else {
var message = "Can't establish a connection to the server at " + this._origin.href;
this.emit('error', new Error(message));
+1 -1
View File
@@ -184,7 +184,7 @@ test.describe("Client", function() { with(this) {
}})
it("emits a 'connect' event when the proxy connects", function() { with(this) {
expect(proxy, "emit").given("connect")
expect(proxy, "emit").given("connect", anything())
expect(proxy, "emit").given("close")
expect(proxy, "emit").given("end")
proxy.write(new Buffer("HTTP/1.1 200 OK\r\n\r\n"))