blob: ae3ee571141172bc4b0432fe32811359a371740e [file] [log] [blame]
Hallvord R. M. Steencfc46b82013-05-14 17:51:511<!doctype html>
2<html>
3 <head>
4 <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open()</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
James Graham234a6722013-09-17 17:54:387 <script src="/common/utils.js"></script>
Ms2ger91fef142014-11-01 09:24:378 <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
9 <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
Hallvord R. M. Steencfc46b82013-05-14 17:51:5110 </head>
11 <body>
12 <div id="log"></div>
13 <script>
14 test(function() {
15 var client = new XMLHttpRequest(),
James Graham234a6722013-09-17 17:54:3816 urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
17 user = token();
18 client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
19 client.setRequestHeader("x-user", user)
Hallvord R. M. Steencfc46b82013-05-14 17:51:5120 client.send(null)
James Graham234a6722013-09-17 17:54:3821 assert_equals(client.responseText, user + "\n" + 'pass')
Hallvord Reiar M. Steen237f53d2013-07-02 11:56:1622 assert_equals(client.getResponseHeader('x-challenge'), 'DID')
Hallvord R. M. Steencfc46b82013-05-14 17:51:5123 }, document.title)
24 </script>
Hallvord Reiar M. Steen237f53d2013-07-02 11:56:1625 <p>Note: this test will only work as expected once per browsing session. Restart browser to re-test.</p>
Hallvord R. M. Steencfc46b82013-05-14 17:51:5126 </body>
27</html>