blob: ce2d14e0112eccd484a7d7455c1879bed6d0f2a8 [file] [log] [blame]
Hallvord Reiar M. Steenab2fb022013-05-28 13:15:451<!doctype html>
2<html>
3 <head>
4 <title>XMLHttpRequest: send() - "Basic" authentication gets 401 response</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
8 </head>
9 <body>
10 <p>Please follow these steps to complete the test:</p>
11 <ol>
12 <li>If you are prompted for user name and password, type in 'usr' and 'secret'</li>
13 </ol>
14 <div id="log"></div>
15 <script>
16 test(function() {
17 var client = new XMLHttpRequest(),
18 urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/')
James Graham234a6722013-09-17 17:54:3819 client.open("GET", location.protocol+'//'+urlstart + "resources/auth5/auth.py", false, 'usr', 'wrongpassword')
Hallvord Reiar M. Steenab2fb022013-05-28 13:15:4520 client.send(null)
21 assert_equals(client.responseText, 'usr' + "\n" + 'secret')
22 }, document.title)
23 </script>
24 </body>
25</html>