mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests Python 3: Port tests in fetch/api [part 1] (#24451) -- wpt-commits: 635bf0a5f8fd80f4bbc8b6bef0046a64c9a55cf7 wpt-pr: 24451
19 lines
575 B
Python
19 lines
575 B
Python
ETAG = b'"123abc"'
|
|
CONTENT_TYPE = b"text/plain"
|
|
CONTENT = b"lorem ipsum dolor sit amet"
|
|
|
|
|
|
def main(request, response):
|
|
# let caching kick in if possible (conditional GET)
|
|
etag = request.headers.get(b"If-None-Match", None)
|
|
if etag == ETAG:
|
|
response.headers.set(b"X-HTTP-STATUS", 304)
|
|
response.status = (304, b"Not Modified")
|
|
return b""
|
|
|
|
# cache miss, so respond with the actual content
|
|
response.status = (200, b"OK")
|
|
response.headers.set(b"ETag", ETAG)
|
|
response.headers.set(b"Content-Type", CONTENT_TYPE)
|
|
return CONTENT
|