blob: d7b9266ede2736a19ca96eff8d88efd82dfe9f28 (
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
|
import Qt 4.6
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.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.send("Test Data");
}
}
|