diff options
author | Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> | 2023-04-04 21:47:38 +0900 |
---|---|---|
committer | Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp> | 2023-04-15 16:11:19 +0000 |
commit | efc037191ae12fda978a3617c8d468f7d55fe279 (patch) | |
tree | 1dafe2a70667fe8e229aee0364dcc0b9e30c2e68 /tests/auto/qml/qqmlxmlhttprequest/data | |
parent | 3991a2e8cabb3df3f06531fbc042d71f5f042dab (diff) |
XHR: Add responseURL
https://xhr.spec.whatwg.org/#the-responseurl-attribute
the attribute was introduced around 2014.
[ChangeLog][Qml][XMLHttpRequest] Added missing responseURL property. This returns the url that was used to retrieve the response data, after any redirects have occurred.
Change-Id: Ice70520913bb306885a10dfd7a3a89da31bcfdeb
Task-number: QTBUG-111217
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'tests/auto/qml/qqmlxmlhttprequest/data')
-rw-r--r-- | tests/auto/qml/qqmlxmlhttprequest/data/responseURL.qml | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlxmlhttprequest/data/responseURL.qml b/tests/auto/qml/qqmlxmlhttprequest/data/responseURL.qml new file mode 100644 index 0000000000..437727abd5 --- /dev/null +++ b/tests/auto/qml/qqmlxmlhttprequest/data/responseURL.qml @@ -0,0 +1,25 @@ +import QtQuick 2.0 + +QtObject { + property string url + property string expectedURL + + property bool dataOK: false + + Component.onCompleted: { + var x = new XMLHttpRequest; + + x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); + + // Test to the end + x.onreadystatechange = function() { + if (x.readyState === XMLHttpRequest.DONE) { + dataOK = (x.responseURL === expectedURL); + } + } + + x.send() + } +} + |