зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1554539 - Fix access-control-basic-options-not-supported.py to consistently fail if the Origin header is unexpectedly missing; r=jgraham
Differential Revision: https://phabricator.services.mozilla.com/D32653 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
245c6a0c97
Коммит
eb5865bd87
|
@ -0,0 +1,4 @@
|
|||
[access-control-basic-post-with-non-cors-safelisted-content-type.htm]
|
||||
[Same-origin request with non-safelisted content type succeeds]
|
||||
expected: FAIL
|
||||
|
|
@ -3,7 +3,10 @@ def main(request, response):
|
|||
|
||||
# Allow simple requests, but deny preflight
|
||||
if request.method != "OPTIONS":
|
||||
response.headers.set("Access-Control-Allow-Credentials", "true")
|
||||
response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin"))
|
||||
if "origin" in request.headers:
|
||||
response.headers.set("Access-Control-Allow-Credentials", "true")
|
||||
response.headers.set("Access-Control-Allow-Origin", request.headers["origin"])
|
||||
else:
|
||||
response.status = 500
|
||||
else:
|
||||
response.status = 400
|
||||
|
|
Загрузка…
Ссылка в новой задаче