|
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 <title>Network Monitor test page</title> |
|
9 </head> |
|
10 |
|
11 <body> |
|
12 <p>POST raw with headers test</p> |
|
13 |
|
14 <script type="text/javascript"> |
|
15 function post(aAddress, aMessage, aCallback) { |
|
16 var xhr = new XMLHttpRequest(); |
|
17 xhr.open("POST", aAddress, true); |
|
18 |
|
19 xhr.onreadystatechange = function() { |
|
20 if (this.readyState == this.DONE) { |
|
21 aCallback(); |
|
22 } |
|
23 }; |
|
24 xhr.send(aMessage); |
|
25 } |
|
26 |
|
27 function performRequests() { |
|
28 var rawData = [ |
|
29 "content-type: application/x-www-form-urlencoded\r", |
|
30 "custom-header: hello world!\r", |
|
31 "\r", |
|
32 "\r", |
|
33 "foo=bar&baz=123" |
|
34 ]; |
|
35 post("sjs_simple-test-server.sjs", rawData.join("\n"), function() { |
|
36 // Done. |
|
37 }); |
|
38 } |
|
39 </script> |
|
40 </body> |
|
41 |
|
42 </html> |