blob: 0196586bb7d1729be3a6ffe82b0b87a6b7b73992 (
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 QtQuick 1.0
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");
}
}
|