sends-report-on-404.https.html (1334B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title> 5 Test that NEL reports are sent for HTTP errors 6 </title> 7 <script src='/resources/testharness.js'></script> 8 <script src='/resources/testharnessreport.js'></script> 9 <script src='./support/nel.sub.js'></script> 10 </head> 11 <body> 12 <script> 13 nel_test(async t => { 14 // Make a request to a resource whose response headers include a NEL 15 // policy. 16 await fetchResourceWithBasicPolicy(); 17 // Make a request to another resource on the same domain. This resource 18 // doesn't exist, so the server should return a 404. 19 await fetchMissingResource(); 20 // The 404 won't contain its own NEL policy, but the policy we received in 21 // the first request should cover the second request, too, since they're 22 // at the same origin, so the collector should have received a report 23 // about it. 24 assert_true(await reportExists({ 25 url: getURLForMissingResource(), 26 user_agent: navigator.userAgent, 27 type: "network-error", 28 body: { 29 method: "GET", 30 sampling_fraction: 1.0, 31 status_code: 404, 32 phase: "application", 33 type: "http.error", 34 }, 35 metadata: { 36 content_type: "application/reports+json", 37 }, 38 })); 39 }); 40 </script> 41 </body> 42 </html>