gecko-dev/testing/web-platform/tests/fetch/api/resources/authentication.py
Philip Jägenstedt 012380465d Bug 1463682 [wpt PR 11116] - Run autopep8 on *.py in cors, fetch and xhr, a=testonly
Automatic update from web-platform-testsRun autopep8 on *.py in cors, fetch and xhr (#11116)

```
find cors fetch xhr -name '*.py' | xargs autopep8 --in-place --max-line-length 1000
```

Then manually pick the "good" changes, ignoring some whitespace stuff.
--

wpt-commits: 15b8e55fa2a0fbf0851cb8e0846e0320e319c852
wpt-pr: 11116
2018-06-05 15:14:50 +01:00

14 lines
451 B
Python

def main(request, response):
user = request.auth.username
password = request.auth.password
if user == "user" and password == "password":
return "Authentication done"
realm = "test"
if "realm" in request.GET:
realm = request.GET.first("realm")
return ((401, "Unauthorized"),
[("WWW-Authenticate", 'Basic realm="' + realm + '"')],
"Please login with credentials 'user' and 'password'")