<html>
<p>Check Digest Access Authentication works well.</p>
<div id="result"></div>

<script>

    if (window.testRunner)
        testRunner.dumpAsText();

    const req = new XMLHttpRequest();

    /* Send auth info after getting authorization header. */
    req.open('GET', 'resources/url-with-credentials/authorize.py', false, 'everybody', 'lovesbeer');
    req.send(null);

    const check = function(req) {
        return req.status == 200 && req.responseText.match(/everybody/);
    }

    document.getElementById('result').innerHTML = check(req) ? 'PASS' : 'FAIL';

</script>
