Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
1 Cu.import("resource://testing-common/httpd.js");
3 var httpserv;
5 function TestListener() {
6 }
8 TestListener.prototype.onStartRequest = function(request, context) {
9 }
11 TestListener.prototype.onStopRequest = function(request, context, status) {
12 httpserv.stop(do_test_finished);
13 }
15 function run_test() {
16 httpserv = new HttpServer();
18 httpserv.registerPathHandler("/bug412945", bug412945);
20 httpserv.start(-1);
22 // make request
23 var channel =
24 Components.classes["@mozilla.org/network/io-service;1"].
25 getService(Components.interfaces.nsIIOService).
26 newChannel("http://localhost:" + httpserv.identity.primaryPort +
27 "/bug412945", null, null);
29 channel.QueryInterface(Components.interfaces.nsIHttpChannel);
30 channel.requestMethod = "POST";
31 channel.asyncOpen(new TestListener(), null);
33 do_test_pending();
34 }
36 function bug412945(metadata, response) {
37 if (!metadata.hasHeader("Content-Length") ||
38 metadata.getHeader("Content-Length") != "0")
39 {
40 do_throw("Content-Length header not found!");
41 }
42 }