html_post-raw-test-page.html (1178B)
1 <!-- Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ --> 3 <!doctype html> 4 5 <html> 6 <head> 7 <meta charset="utf-8"/> 8 <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> 9 <meta http-equiv="Pragma" content="no-cache" /> 10 <meta http-equiv="Expires" content="0" /> 11 <title>Network Monitor test page</title> 12 </head> 13 14 <body> 15 <p>POST raw test</p> 16 17 <script type="text/javascript"> 18 /* exported performRequests */ 19 "use strict"; 20 21 function post(address, message) { 22 return new Promise(resolve => { 23 const xhr = new XMLHttpRequest(); 24 xhr.open("POST", address, true); 25 xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded"); 26 27 xhr.onreadystatechange = function() { 28 if (this.readyState == this.DONE) { 29 resolve(); 30 } 31 }; 32 xhr.send(message); 33 }); 34 } 35 36 async function performRequests() { 37 const rawData = "foo=bar&baz=123"; 38 await post("sjs_simple-test-server.sjs", rawData); 39 } 40 </script> 41 </body> 42 43 </html>