File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 9898 }
9999
100100 function getRequestData ( request , keyPath ) {
101- var data = decodeURIComponent ( request . requestBody . match ( / d a t a = ( [ ^ & ] + ) / ) [ 1 ] ) ;
102101 try {
103- data = atob ( data ) ;
104- } catch ( err ) {
105- // plain json?
106- }
107- try {
108- data = JSON . parse ( data ) ;
102+ var data = JSON . parse ( decodeURIComponent ( request . requestBody . match ( / d a t a = ( [ ^ & ] + ) / ) [ 1 ] ) ) ;
109103 ( keyPath || [ ] ) . forEach ( function ( key ) {
110104 data = data [ key ] ;
111105 } ) ;
39323926 ) ;
39333927 } ) ;
39343928 }
3929+
3930+ test ( "tracking can be configured to use base64 encoding" , 3 , function ( ) {
3931+ mixpanel . test . set_config ( { api_payload_format : 'base64' } ) ;
3932+ mixpanel . test . track ( 'test' , { foo : 'bar' } ) ;
3933+ same ( this . requests . length , 1 , "track should have fired off a request" ) ;
3934+ var data = JSON . parse ( atob ( decodeURIComponent ( this . requests [ 0 ] . requestBody . match ( / d a t a = ( [ ^ & ] + ) / ) [ 1 ] ) ) ) ;
3935+ same ( data . event , 'test' ) ;
3936+ same ( data . properties . foo , 'bar' ) ;
3937+ } ) ;
39353938 }
39363939
39373940 if ( USE_XHR && window . localStorage ) {
You can’t perform that action at this time.
0 commit comments