diff --git a/lib/fake-server/index.js b/lib/fake-server/index.js index 2523f7b..a189722 100644 --- a/lib/fake-server/index.js +++ b/lib/fake-server/index.js @@ -150,7 +150,6 @@ var fakeServer = { fakeHTTPMethods: true, logger: true, unsafeHeadersEnabled: true, - legacyRoutes: true, }; // eslint-disable-next-line no-param-reassign @@ -214,8 +213,6 @@ var fakeServer = { log: log, - legacyRoutes: true, - respondWith: function respondWith(method, url, body) { if (arguments.length === 1 && typeof method !== "function") { this.response = responseArray(method); @@ -255,13 +252,6 @@ var fakeServer = { // eslint-disable-next-line no-param-reassign url = url.replace(/\/\*/g, "/*path"); } - - if (this.legacyRoutes) { - if (url.includes("?")) { - // eslint-disable-next-line no-param-reassign - url = url.replace("?", "\\?"); - } - } } push.call(this.responses, { method: method, diff --git a/lib/fake-server/index.test.js b/lib/fake-server/index.test.js index 21d8796..6db0937 100644 --- a/lib/fake-server/index.test.js +++ b/lib/fake-server/index.test.js @@ -108,16 +108,6 @@ describe("sinonFakeServer", function () { "fakeServer.create should not accept 'foo' settings", ); }); - - it("allows the 'legacyRoutes' setting", function () { - var server = sinonFakeServer.create({ - legacyRoutes: false, - }); - assert( - server.legacyRoutes === false, - "fakeServer.create should accept 'legacyRoutes' setting", - ); - }); }); it("fakes XMLHttpRequest", function () { @@ -913,9 +903,8 @@ describe("sinonFakeServer", function () { assert(handler.calledOnce); }); - it("yields response to handler when url contains escaped RegExp characters in non-legacy mode", function () { + it("yields response to request function handler when url contains RegExp characters", function () { var handler = sinon.spy(); - this.server.legacyRoutes = false; this.server.respondWith("GET", "/hello\\?world", handler); var xhr = new FakeXMLHttpRequest(); xhr.open("GET", "/hello?world"); @@ -926,18 +915,6 @@ describe("sinonFakeServer", function () { assert(handler.calledOnce); }); - it("yields response to handler when url contains unescaped RegExp characters in legacy mode", function () { - var handler = sinon.spy(); - this.server.respondWith("GET", "/hello?world", handler); - var xhr = new FakeXMLHttpRequest(); - xhr.open("GET", "/hello?world"); - xhr.send(); - - this.server.respond(); - - assert(handler.calledOnce); - }); - function equalMatcher(expected) { return function (test) { return expected === test;