aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlxmlhttprequest/data/send_data.9.qml
blob: 834916f96c022299de2becab55bcf7410905b9a8 (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
import QtQuick 2.0

QtObject {
    property string url

    property bool dataOK: false
    property bool headerOK: false

    Component.onCompleted: {
        var x = new XMLHttpRequest;
        x.open("OPTIONS", url);

        // Test to the end
        x.onreadystatechange = function() {
            if (x.readyState == XMLHttpRequest.HEADERS_RECEIVED) {
                headerOK = (x.getResponseHeader("Allow") == "GET,HEAD,POST,OPTIONS,TRACE");
            } else if (x.readyState == XMLHttpRequest.DONE) {
                dataOK = (x.responseText == "");
            }
        }

        x.send("My Sent Data");
    }
}