html_copy-as-curl.html (1089B)
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>Performing requests of various methods, with or without payload.</p> 16 17 <script type="text/javascript"> 18 /* exported performRequest */ 19 "use strict"; 20 21 function performRequest(url, method, payload = null) { 22 const xhr = new XMLHttpRequest(); 23 xhr.open(method, url, true); 24 xhr.setRequestHeader("Accept-Language", window.navigator.language); 25 xhr.setRequestHeader("X-Custom-Header-1", "Custom value"); 26 xhr.setRequestHeader("X-Custom-Header-2", "8.8.8.8"); 27 xhr.setRequestHeader("X-Custom-Header-3", "Mon, 3 Mar 2014 11:11:11 GMT"); 28 xhr.send(payload); 29 } 30 </script> 31 </body> 32 33 </html>