@@ -220,86 +220,6 @@ module.exports = {
220220 } ) ;
221221 } ,
222222
223- 'test authorization gets handshake data' : function ( done ) {
224- var port = ++ ports
225- , io = sio . listen ( port )
226- , cl = client ( port ) ;
227-
228- io . configure ( function ( ) {
229- function auth ( data , fn ) {
230- data . query . should . have . foo ;
231- data . query . foo . should . eql ( 'bar' ) ;
232- fn ( null , false ) ;
233- } ;
234-
235- io . set ( 'authorization' , auth ) ;
236- } ) ;
237-
238- cl . get ( '/socket.io/{protocol}/?foo=bar' , function ( res , data ) {
239- res . statusCode . should . eql ( 403 ) ;
240- data . should . match ( / h a n d s h a k e u n a u t h o r i z e d / ) ;
241-
242- cl . end ( ) ;
243- io . server . close ( ) ;
244- done ( ) ;
245- } ) ;
246- } ,
247-
248- 'test that authorization can view handshake data' : function ( done ) {
249- var port = ++ ports
250- , io = sio . listen ( port )
251- , cl = client ( port ) ;
252-
253- io . configure ( function ( ) {
254- function auth ( data , fn ) {
255- data . query . should . have . foo ;
256- data . query . foo . should . eql ( 'bar' ) ;
257- fn ( null , true ) ;
258- } ;
259-
260- io . set ( 'authorization' , auth ) ;
261- } ) ;
262-
263- cl . get ( '/socket.io/{protocol}/?foo=bar' , function ( res , data ) {
264- res . statusCode . should . eql ( 200 ) ;
265-
266- cl . end ( ) ;
267- io . server . close ( ) ;
268- done ( ) ;
269- } ) ;
270- } ,
271-
272- 'test that authorization can change handshake data' : function ( done ) {
273- var port = ++ ports
274- , io = sio . listen ( port )
275- , cl = client ( port ) ;
276-
277- io . configure ( function ( ) {
278- function auth ( data , fn ) {
279- var replacement = { baz : 'qu' } ;
280- for ( i in data ) {
281- if ( data . hasOwnProperty ( i ) ) {
282- replacement [ i ] = data [ i ] ;
283- }
284- }
285- fn ( null , true , replacement ) ;
286- } ;
287-
288- io . set ( 'authorization' , auth ) ;
289- } ) ;
290-
291- cl . get ( '/socket.io/{protocol}/' , function ( res , data ) {
292- var id = data . split ( ':' , 2 ) [ 0 ] ;
293- res . statusCode . should . eql ( 200 ) ;
294- io . handshaken [ id ] . should . have . baz ;
295- io . handshaken [ id ] . baz . should . eql ( 'qu' ) ;
296-
297- cl . end ( ) ;
298- io . server . close ( ) ;
299- done ( ) ;
300- } ) ;
301- } ,
302-
303223 'test a handshake error' : function ( done ) {
304224 var port = ++ ports
305225 , io = sio . listen ( port )
0 commit comments