diff --git a/test/fixtures/wpt/xhr/request-content-length.any.js b/test/fixtures/wpt/xhr/request-content-length.any.js index 054d2cce9d2..69a1e168365 100644 --- a/test/fixtures/wpt/xhr/request-content-length.any.js +++ b/test/fixtures/wpt/xhr/request-content-length.any.js @@ -11,6 +11,7 @@ async_test(test => { assert_true(happened); assert_true(client.responseText.includes(`Content-Length: ${data.length}`)); }); + client.onerror = test.unreached_func(); client.open("POST", "resources/echo-headers.py"); client.send(data); }, "Uploads need to set the Content-Length header"); diff --git a/test/fixtures/wpt/xhr/resources/echo-headers.py b/test/fixtures/wpt/xhr/resources/echo-headers.py index 58a7ed5637f..63943082b63 100644 --- a/test/fixtures/wpt/xhr/resources/echo-headers.py +++ b/test/fixtures/wpt/xhr/resources/echo-headers.py @@ -1,7 +1,9 @@ def main(request, response): + content = str(request.raw_headers) response.writer.write_status(200) response.writer.write_header(b"Content-Type", b"text/plain") + response.writer.write_header(b"Content-Length", str(len(content))) response.writer.write_header(b"Connection", b"close") response.writer.end_headers() - response.writer.write(str(request.raw_headers)) + response.writer.write(content) response.close_connection = True