blob: a3d2713d0f419aaeb29098731ebad3da33de2d3d [file] [log] [blame]
ronkorving08ca59a2013-06-08 04:33:211<!doctype html>
2<html>
3 <head>
4 <title>XMLHttpRequest: GZIP response was correctly inflated</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
Hallvord Reiar M. Steenc136f2b2013-06-10 13:51:457 <link rel="help" href="https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::p[contains(text(),'content-encodings')]" />
ronkorving08ca59a2013-06-08 04:33:218 </head>
9 <body>
10 <div id="log"></div>
11 <script>
12 function request(input) {
13 var test = async_test();
14 test.step(function() {
15 var client = new XMLHttpRequest()
ronkorving6a6eb212013-06-08 04:35:3816
James Graham234a6722013-09-17 17:54:3817 client.open("POST", "resources/gzip.py", false);
ronkorving08ca59a2013-06-08 04:33:2118
19 client.onreadystatechange = test.step_func(function () {
20 if (client.readyState === 4) {
21 var len = parseInt(client.getResponseHeader('content-length'), 10);
22
ronkorving4d094d52013-06-08 05:00:4323 assert_equals(client.getResponseHeader('content-encoding'), 'gzip');
ronkorving08ca59a2013-06-08 04:33:2124 assert_true(len < input.length);
25 assert_equals(client.responseText, input);
26 test.done();
27 }
28 });
29
30 client.send(input);
31 }, document.title);
32 }
33
34 var wellCompressableData = '';
35 for (var i = 0; i < 500; i++) {
36 wellCompressableData += 'foofoofoofoofoofoofoo';
37 }
38
39 request(wellCompressableData);
40 </script>
41 </body>
42</html>