netwerk/test/unit/test_bug477578.js

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

michael@0 1 // test that methods are not normalized
michael@0 2
michael@0 3 const testMethods = [
michael@0 4 ["GET"],
michael@0 5 ["get"],
michael@0 6 ["Get"],
michael@0 7 ["gET"],
michael@0 8 ["gEt"],
michael@0 9 ["post"],
michael@0 10 ["POST"],
michael@0 11 ["head"],
michael@0 12 ["HEAD"],
michael@0 13 ["put"],
michael@0 14 ["PUT"],
michael@0 15 ["delete"],
michael@0 16 ["DELETE"],
michael@0 17 ["connect"],
michael@0 18 ["CONNECT"],
michael@0 19 ["options"],
michael@0 20 ["trace"],
michael@0 21 ["track"],
michael@0 22 ["copy"],
michael@0 23 ["index"],
michael@0 24 ["lock"],
michael@0 25 ["m-post"],
michael@0 26 ["mkcol"],
michael@0 27 ["move"],
michael@0 28 ["propfind"],
michael@0 29 ["proppatch"],
michael@0 30 ["unlock"],
michael@0 31 ["link"],
michael@0 32 ["LINK"],
michael@0 33 ["foo"],
michael@0 34 ["foO"],
michael@0 35 ["fOo"],
michael@0 36 ["Foo"]
michael@0 37 ]
michael@0 38
michael@0 39 function run_test() {
michael@0 40 var ios =
michael@0 41 Cc["@mozilla.org/network/io-service;1"].
michael@0 42 getService(Ci.nsIIOService);
michael@0 43
michael@0 44 var chan = ios.newChannel("http://localhost/", null, null)
michael@0 45 .QueryInterface(Components.interfaces.nsIHttpChannel);
michael@0 46
michael@0 47 for (var i = 0; i < testMethods.length; i++) {
michael@0 48 chan.requestMethod = testMethods[i];
michael@0 49 do_check_eq(chan.requestMethod, testMethods[i]);
michael@0 50 }
michael@0 51 }

mercurial