diff options
author | jaubourg <j@ubourg.net> | 2011-02-17 17:03:09 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-02-17 17:03:09 +0100 |
commit | 5b38439011799ae53156d137305d9440e0cddb0a (patch) | |
tree | 1555f58d0384fc9c01692f4445e01fe668d3444b /test | |
parent | faa6fe32f72900d7b31000caead2794a8346f6d8 (diff) | |
download | jquery-5b38439011799ae53156d137305d9440e0cddb0a.tar.gz jquery-5b38439011799ae53156d137305d9440e0cddb0a.zip |
Fixes #8297. Makes sure response headers with empty values are handled properly and do not prevent proper parsing of the entire response headers string. Unit test amended.
Diffstat (limited to 'test')
-rw-r--r-- | test/data/headers.php | 2 | ||||
-rw-r--r-- | test/unit/ajax.js | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/test/data/headers.php b/test/data/headers.php index d500b16f4..968f13f19 100644 --- a/test/data/headers.php +++ b/test/data/headers.php @@ -1,6 +1,8 @@ <?php header( "Sample-Header: Hello World" ); +header( "Empty-Header: " ); +header( "Sample-Header2: Hello World 2" ); $headers = array(); diff --git a/test/unit/ajax.js b/test/unit/ajax.js index 80da7f8f8..335c2ac4d 100644 --- a/test/unit/ajax.js +++ b/test/unit/ajax.js @@ -344,7 +344,7 @@ test(".ajax() - retry with jQuery.ajax( this )", function() { test(".ajax() - headers" , function() { - expect( 2 ); + expect( 4 ); stop(); @@ -376,8 +376,14 @@ test(".ajax() - headers" , function() { tmp.push( "ajax-send: test\n" ); tmp = tmp.join( "" ); - equals( data , tmp , "Headers were sent" ); - equals( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" ); + strictEqual( data , tmp , "Headers were sent" ); + strictEqual( xhr.getResponseHeader( "Sample-Header" ) , "Hello World" , "Sample header received" ); + if ( jQuery.browser.mozilla ) { + ok( true, "Firefox doesn't support empty headers" ); + } else { + strictEqual( xhr.getResponseHeader( "Empty-Header" ) , "" , "Empty header received" ); + } + strictEqual( xhr.getResponseHeader( "Sample-Header2" ) , "Hello World 2" , "Second sample header received" ); }, error: function(){ ok(false, "error"); } |