diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-11-15 11:17:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-15 11:17:18 -0500 |
commit | 13e322183df9836ea1330e64756a7fddf7da972f (patch) | |
tree | 7089c8dedad5e1173185e96be651917707b57857 /tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py | |
parent | 359ec7a76f1eb5d70360ff2b8c49923e9383eca7 (diff) | |
parent | ff06f1d031be33fd4ea319f821b789ddacacbdf6 (diff) | |
download | servo-13e322183df9836ea1330e64756a7fddf7da972f.tar.gz servo-13e322183df9836ea1330e64756a7fddf7da972f.zip |
Auto merge of #22199 - servo-wpt-sync:wpt_update_14-11-2018, r=jdm
Sync WPT with upstream (14-11-2018)
Automated downstream sync of changes from upstream as of 14-11-2018.
[no-wpt-sync]
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22199)
<!-- Reviewable:end -->
Diffstat (limited to 'tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py')
-rw-r--r-- | tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py b/tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py new file mode 100644 index 00000000000..f98a503a51e --- /dev/null +++ b/tests/wpt/web-platform-tests/network-error-logging/support/cached-with-validation.py @@ -0,0 +1,17 @@ +ETAG = '"123abc"' +CONTENT_TYPE = "text/plain" +CONTENT = "lorem ipsum dolor sit amet" + +def main(request, response): + # let caching kick in if possible (conditional GET) + etag = request.headers.get("If-None-Match", None) + if etag == ETAG: + response.headers.set("X-HTTP-STATUS", 304) + response.status = (304, "Not Modified") + return "" + + # cache miss, so respond with the actual content + response.status = (200, "OK") + response.headers.set("ETag", ETAG) + response.headers.set("Content-Type", CONTENT_TYPE) + return CONTENT |