]> source.dussan.org Git - jquery.git/commitdiff
Tweaked the headers test to be apache independent and actually work.
authorjaubourg <aubourg.julian@gmail.com>
Sat, 11 Dec 2010 01:21:54 +0000 (02:21 +0100)
committerjaubourg <aubourg.julian@gmail.com>
Sat, 11 Dec 2010 01:21:54 +0000 (02:21 +0100)
test/data/headers.request.php
test/unit/ajax.js

index c511a517a9375a8761db7a2fc80f549cb2f2aa7e..47250932e49f939e83ee713b0cb616d736d69a2e 100644 (file)
@@ -1,21 +1,18 @@
 <?php
 
-if (!function_exists('apache_request_headers')) { 
-       function apache_request_headers() { 
-               foreach($_SERVER as $key=>$value) { 
-                       if (substr($key,0,5)=="HTTP_") { 
-                               $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); 
-                               $out[$key]=$value; 
-                       }else{ 
-                               $out[$key]=$value; 
-                       } 
-               } 
-               return $out; 
-       } 
-} 
+$headers = array();
+
+foreach( $_SERVER as $key => $value ) { 
+       
+       if ( substr( $key , 0 , 5 ) == "HTTP_" ) { 
+               
+               $key = str_replace( " " , "-" , ucwords( strtolower( str_replace( "_" , " " , substr( $key , 5) ) ) ) );
+               $headers[ $key ] = $value;
 
-$headers = apache_request_headers();
+       }
+       
+} 
 
 foreach( explode( "_" , $_GET[ "keys" ] ) as $key ) {
-       echo "$key: $headers[$key]\n";
+       echo "$key: " . $headers[ str_replace( " " , "-" , ucwords( strtolower( str_replace( "-" , " " , $key ) ) ) ) ] . "\n";
 }
index d0f2e435cde61714777e9a58e2ef9e3473d6f6ca..b11342f3f61a1df616dab412b3a726256f69d39f 100644 (file)
@@ -286,16 +286,16 @@ test(".ajax() - headers" , function() {
        stop();
        
        var requestHeaders = {
-               Simple: "value",
-               "Something-Else": "other value",
-               Other: "something else"
+               siMPle: "value",
+               "SometHing-elsE": "other value",
+               OthEr: "something else"
                },
                list = [],
                i,
                sync = 2;
                
        for( i in requestHeaders ) {
-               list.push( i.toLowerCase() );
+               list.push( i );
        }
        
        list = list.join( "_" );
@@ -305,7 +305,7 @@ test(".ajax() - headers" , function() {
                success: function( data ) {
                        var tmp = [];
                        for ( i in requestHeaders ) {
-                               tmp.push( i.toLowerCase() , ": " , requestHeaders[ i ] , "\n" );
+                               tmp.push( i , ": " , requestHeaders[ i ] , "\n" );
                        }
                        tmp = tmp.join( "" );