blob: 24e4071a600563c07baaf10fc166c919740aadf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import Qt 4.7
QtObject {
property string urlDummy
property string url
property bool seenDone: false
property bool didNotSeeUnsent: true
property bool endStateUnsent: false
property bool dataOK: false
Component.onCompleted: {
var x = new XMLHttpRequest;
x.open("GET", urlDummy);
x.setRequestHeader("Test-header", "TestValue");
x.setRequestHeader("Accept-Language", "en-US");
x.send();
x.onreadystatechange = function() {
if (x.readyState == XMLHttpRequest.DONE) {
seenDone = true;
} else if (x.readyState == XMLHttpRequest.UNSENT) {
didNotSeeUnsent = false;
}
}
x.abort();
if (x.readyState == XMLHttpRequest.UNSENT) {
endStateUnsent = true;
}
x.onreadystatechange = function() {
if (x.readyState == XMLHttpRequest.DONE) {
dataOK = (x.responseText == "QML Rocks!\n");
}
}
x.open("PUT", url);
x.setRequestHeader("Accept-Language", "en-US");
x.send("Test Data");
}
}
|