| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <body> | |
| 3 Tests that sending undefined or null results in an empty request body. | |
| 4 <script> | |
| 5 if (window.testRunner) | |
| 6 testRunner.dumpAsText(); | |
| 7 | |
| 8 var console_messages = document.createElement("ul"); | |
| 9 document.body.appendChild(console_messages); | |
| 10 | |
| 11 function log(message) | |
| 12 { | |
| 13 var item = document.createElement("li"); | |
| 14 item.appendChild(document.createTextNode(message)); | |
| 15 console_messages.appendChild(item); | |
| 16 } | |
| 17 | |
| 18 xhr = new XMLHttpRequest; | |
| 19 xhr.open("POST", "resources/post-echo.cgi", false); | |
| 20 xhr.send(undefined); | |
| 21 if (!xhr.responseText.length) | |
| 22 log("PASS for undefined"); | |
| 23 else | |
| 24 log("FAILED: The posted content when sending 'undefined' is '" + xhr.respons
eText +"'. It should have been ''."); | |
| 25 | |
| 26 xhr = new XMLHttpRequest; | |
| 27 xhr.open("POST", "resources/post-echo.cgi", false); | |
| 28 xhr.send(null); | |
| 29 if (!xhr.responseText.length) | |
| 30 log("PASS for null"); | |
| 31 else | |
| 32 log("FAILED: The posted content when sending 'null' is '" + xhr.responseText
+"'. It should have been ''."); | |
| 33 </script> | |
| 34 </body> | |
| 35 </html> | |
| OLD | NEW |