From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- dom/xhr/tests/responseIdentical.sjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 dom/xhr/tests/responseIdentical.sjs (limited to 'dom/xhr/tests/responseIdentical.sjs') diff --git a/dom/xhr/tests/responseIdentical.sjs b/dom/xhr/tests/responseIdentical.sjs new file mode 100644 index 0000000000..0e7b796e0f --- /dev/null +++ b/dom/xhr/tests/responseIdentical.sjs @@ -0,0 +1,19 @@ +const CC = Components.Constructor; +const BinaryInputStream = CC( + "@mozilla.org/binaryinputstream;1", + "nsIBinaryInputStream", + "setInputStream" +); + +// Simply sending back the same data that is received +function handleRequest(request, response) { + var body = ""; + var bodyStream = new BinaryInputStream(request.bodyInputStream); + var avail = 0; + while ((avail = bodyStream.available()) > 0) { + body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); + } + + response.setHeader("Content-Type", "application/octet-stream", false); + response.write(body); +} -- cgit v1.2.3