cache-revalidate-construct-range-response.html (1039B)
1 <!DOCTYPE html> 2 <meta name="timeout" content="long"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <body> 6 <script> 7 8 promise_test(async t => { 9 const url = new URL('resources/video-with-aged-proxy-cache.py', location.href); 10 const response_1 = await fetch(url.toString()); 11 assert_equals(response_1.status, 200, 'Initial fetch should succeed with 200'); 12 const response_1_blob = await response_1.blob(); 13 assert_equals(response_1_blob.size, 80666, 'Initial fetch should get full content'); 14 const response_2 = await fetch(url.toString(), { 15 headers: {'Range': 'bytes=0-99'} 16 }); 17 const response_2_blob = await response_2.blob(); 18 assert_equals(response_2.status, 206, 'Range fetch after cache revalidation should succeed with 206'); 19 assert_equals(response_2_blob.size, 100, 'Range fetch after cache revalidation should get partial content'); 20 }, `Range request after cache revalidation with 200 OK response should succeed`); 21 22 </script> 23 </body>