mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Update web-platform-tests to revision 077bb422b7bb21491a414e334bc594d83ca9e55b
This commit is contained in:
parent
aa9591137a
commit
b2341e328d
248 changed files with 2930 additions and 1961 deletions
24
tests/wpt/web-platform-tests/client-hints/resources/dpr.py
Normal file
24
tests/wpt/web-platform-tests/client-hints/resources/dpr.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
def main(request, response):
|
||||
"""
|
||||
Simple handler that sets a response header based on which client hint
|
||||
request headers were received.
|
||||
"""
|
||||
|
||||
response.headers.append("Access-Control-Allow-Origin", "*")
|
||||
values = request.GET
|
||||
name = values.first('name')
|
||||
type = values.first('mimeType')
|
||||
dpr = values.first('dpr')
|
||||
double = None
|
||||
if 'double' in values:
|
||||
double = values.first('double')
|
||||
image_path = request.doc_root + "/".join(request.url_parts[2].split("/")[:-1]) + "/" + name
|
||||
f = open(image_path, "rb")
|
||||
buff = f.read()
|
||||
f.close()
|
||||
response.headers.set("Content-Type", type)
|
||||
response.headers.set("Content-DPR", dpr)
|
||||
if double:
|
||||
response.headers.append("Content-DPR", double)
|
||||
response.headers.set("Content-Length", len(buff))
|
||||
response.content = buff
|
Loading…
Add table
Add a link
Reference in a new issue