html_har_import-test-page.html (1422B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ --> 3 4 <!doctype html> 5 6 <html> 7 <head> 8 <meta charset="utf-8"/> 9 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> 10 <meta http-equiv="Pragma" content="no-cache" /> 11 <meta http-equiv="Expires" content="0" /> 12 <title>Network Monitor Test Page</title> 13 </head> 14 15 <body> 16 <p>HAR import test</p> 17 18 <script type="text/javascript"> 19 /* exported executeTest, executeTest2, executeTest3 */ 20 "use strict"; 21 22 function post(address, data) { 23 return new Promise(resolve => { 24 const xhr = new XMLHttpRequest(); 25 xhr.open("POST", address, true); 26 xhr.setRequestHeader("Content-Type", "application/json"); 27 xhr.onload = resolve; 28 xhr.send(data); 29 }); 30 } 31 32 function get(address) { 33 return new Promise(resolve => { 34 const xhr = new XMLHttpRequest(); 35 xhr.open("GET", address); 36 xhr.onload = resolve; 37 xhr.send(); 38 }); 39 } 40 41 async function executeTest() { 42 const url = "html_har_import-test-page.html"; 43 const data = "{'first': 'John', 'last': 'Doe'}"; 44 await post(url, data); 45 await get("sjs_cookies-test-server.sjs"); 46 await get("sjs_cache-test-server.sjs"); 47 } 48 </script> 49 </body> 50 51 </html>