diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py')
-rw-r--r-- | testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py new file mode 100644 index 0000000000..675b3fc3eb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/serve-with-content-type.py @@ -0,0 +1,17 @@ +import os + +from wptserve.utils import isomorphic_decode + +def main(request, response): + directory = os.path.dirname(isomorphic_decode(__file__)) + + try: + file_name = request.GET.first(b"fn") + content_type = request.GET.first(b"ct") + with open(os.path.join(directory, isomorphic_decode(file_name)), u"rb") as fh: + content = fh.read() + + response.headers.set(b"Content-Type", content_type) + response.content = content + except: + response.set_error(400, u"Not enough parameters or file not found") |