diff options
author | jaubourg <aubourg.julian@gmail.com> | 2010-12-11 02:21:54 +0100 |
---|---|---|
committer | jaubourg <aubourg.julian@gmail.com> | 2010-12-11 02:21:54 +0100 |
commit | 0b0889ceaaafb1fe37a87b14476066b8f9e93ce9 (patch) | |
tree | c56147add1fb5b7002716c987647479d2e90081e /test | |
parent | 9d3a4a2b409f7a4c53800bb36b0de39c0c0084ae (diff) | |
download | jquery-0b0889ceaaafb1fe37a87b14476066b8f9e93ce9.tar.gz jquery-0b0889ceaaafb1fe37a87b14476066b8f9e93ce9.zip |
Tweaked the headers test to be apache independent and actually work.
Diffstat (limited to 'test')
-rw-r--r-- | test/data/headers.request.php | 27 | ||||
-rw-r--r-- | test/unit/ajax.js | 10 |
2 files changed, 17 insertions, 20 deletions
diff --git a/test/data/headers.request.php b/test/data/headers.request.php index c511a517a..47250932e 100644 --- a/test/data/headers.request.php +++ b/test/data/headers.request.php @@ -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"; } diff --git a/test/unit/ajax.js b/test/unit/ajax.js index d0f2e435c..b11342f3f 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -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( "" ); |