Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / netwerk / test / unit / test_bug412945.js
blobc44aa48795fde807edb19ef64562df4e134ba26b
1 "use strict";
3 const { HttpServer } = ChromeUtils.importESModule(
4 "resource://testing-common/httpd.sys.mjs"
5 );
7 var httpserv;
9 function TestListener() {}
11 TestListener.prototype.onStartRequest = function () {};
13 TestListener.prototype.onStopRequest = function () {
14 httpserv.stop(do_test_finished);
17 function run_test() {
18 httpserv = new HttpServer();
20 httpserv.registerPathHandler("/bug412945", bug412945);
22 httpserv.start(-1);
24 // make request
25 var channel = NetUtil.newChannel({
26 uri: "http://localhost:" + httpserv.identity.primaryPort + "/bug412945",
27 loadUsingSystemPrincipal: true,
28 });
30 channel.QueryInterface(Ci.nsIHttpChannel);
31 channel.requestMethod = "POST";
32 channel.asyncOpen(new TestListener(), null);
34 do_test_pending();
37 function bug412945(metadata) {
38 if (
39 !metadata.hasHeader("Content-Length") ||
40 metadata.getHeader("Content-Length") != "0"
41 ) {
42 do_throw("Content-Length header not found!");