@@ -47,7 +47,6 @@ var protocol = argv.https ? 'https' : 'http',
47
47
wsprotocol = argv . https ? 'wss' : 'ws' ,
48
48
runner = new helpers . TestRunner ( protocol ) ;
49
49
50
- require ( 'eyes' ) . inspect ( protocol ) ;
51
50
vows . describe ( 'node-http-proxy/websocket' ) . addBatch ( {
52
51
"When using server created by httpProxy.createServer()" : {
53
52
"with no latency" : {
@@ -69,8 +68,8 @@ vows.describe('node-http-proxy/websocket').addBatch({
69
68
//
70
69
// Setup the web socket against our proxy
71
70
//
72
- var ws = new websocket . WebSocket ( wsprotocol + '://localhost :8131/socket.io/websocket/' , 'borf' , {
73
- origin : 'https ://localhost '
71
+ var ws = new websocket . WebSocket ( wsprotocol + '://home.devjitsu.com :8131/socket.io/websocket/' , 'borf' , {
72
+ origin : protocol + ' ://home.devjitsu.com '
74
73
} ) ;
75
74
76
75
ws . on ( 'wsupgrade' , function ( req , res ) {
@@ -86,7 +85,9 @@ vows.describe('node-http-proxy/websocket').addBatch({
86
85
} ,
87
86
"the target server should receive the message" : function ( err , msg , headers ) {
88
87
assert . equal ( msg , 'from client' ) ;
89
- require ( 'eyes' ) . inspect ( headers ) ;
88
+ } ,
89
+ "the origin and sec-websocket-origin headers should match" : function ( err , msg , headers ) {
90
+ assert . equal ( headers . request . Origin , headers . response [ 'sec-websocket-origin' ] ) ;
90
91
}
91
92
} ,
92
93
"when an outbound message is sent from the target server" : {
@@ -105,8 +106,8 @@ vows.describe('node-http-proxy/websocket').addBatch({
105
106
//
106
107
// Setup the web socket against our proxy
107
108
//
108
- var ws = new websocket . WebSocket ( wsprotocol + '://localhost :8133/socket.io/websocket/' , 'borf' , {
109
- origin : 'https ://localhost '
109
+ var ws = new websocket . WebSocket ( wsprotocol + '://home.devjitsu.com :8133/socket.io/websocket/' , 'borf' , {
110
+ origin : protocol + ' ://home.devjitsu.com '
110
111
} ) ;
111
112
112
113
ws . on ( 'wsupgrade' , function ( req , res ) {
@@ -125,7 +126,9 @@ vows.describe('node-http-proxy/websocket').addBatch({
125
126
} ,
126
127
"the client should receive the message" : function ( err , msg , headers ) {
127
128
assert . equal ( msg , 'from server' ) ;
128
- require ( 'eyes' ) . inspect ( headers ) ;
129
+ } ,
130
+ "the origin and sec-websocket-origin headers should match" : function ( err , msg , headers ) {
131
+ assert . equal ( headers . request . Origin , headers . response [ 'sec-websocket-origin' ] ) ;
129
132
}
130
133
}
131
134
}
0 commit comments