Skip to content

Instantly share code, notes, and snippets.

@KiChjang
Created February 16, 2016 05:19
Show Gist options
  • Save KiChjang/eb24c63e3fc7f2230c3f to your computer and use it in GitHub Desktop.
Save KiChjang/eb24c63e3fc7f2230c3f to your computer and use it in GitHub Desktop.
<script>
test(function() {
var client = new XMLHttpRequest(),
urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
user = token();
client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false)
client.setRequestHeader("x-user", user)
client.send(null)
client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
client.setRequestHeader("x-user", user)
client.send(null)
assert_equals(client.responseText, user + "\n" + 'pass')
assert_equals(client.getResponseHeader('x-challenge'), 'DID')
}, document.title)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment