Skip to content

Commit fe6d236

Browse files
committed
Revert "feat: add legacyRoutes option (#223)"
This reverts commit da6f09c. After the version 8 breaking changes in path-to-regexp this is essentially a no-op, so this is not a breaking change. closes #224
1 parent 840bef6 commit fe6d236

File tree

2 files changed

+1
-34
lines changed

2 files changed

+1
-34
lines changed

lib/fake-server/index.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ var fakeServer = {
150150
fakeHTTPMethods: true,
151151
logger: true,
152152
unsafeHeadersEnabled: true,
153-
legacyRoutes: true,
154153
};
155154

156155
// eslint-disable-next-line no-param-reassign
@@ -214,8 +213,6 @@ var fakeServer = {
214213

215214
log: log,
216215

217-
legacyRoutes: true,
218-
219216
respondWith: function respondWith(method, url, body) {
220217
if (arguments.length === 1 && typeof method !== "function") {
221218
this.response = responseArray(method);
@@ -255,13 +252,6 @@ var fakeServer = {
255252
// eslint-disable-next-line no-param-reassign
256253
url = url.replace(/\/\*/g, "/*path");
257254
}
258-
259-
if (this.legacyRoutes) {
260-
if (url.includes("?")) {
261-
// eslint-disable-next-line no-param-reassign
262-
url = url.replace("?", "\\?");
263-
}
264-
}
265255
}
266256
push.call(this.responses, {
267257
method: method,

lib/fake-server/index.test.js

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,6 @@ describe("sinonFakeServer", function () {
108108
"fakeServer.create should not accept 'foo' settings",
109109
);
110110
});
111-
112-
it("allows the 'legacyRoutes' setting", function () {
113-
var server = sinonFakeServer.create({
114-
legacyRoutes: false,
115-
});
116-
assert(
117-
server.legacyRoutes === false,
118-
"fakeServer.create should accept 'legacyRoutes' setting",
119-
);
120-
});
121111
});
122112

123113
it("fakes XMLHttpRequest", function () {
@@ -913,9 +903,8 @@ describe("sinonFakeServer", function () {
913903
assert(handler.calledOnce);
914904
});
915905

916-
it("yields response to handler when url contains escaped RegExp characters in non-legacy mode", function () {
906+
it("yields response to request function handler when url contains RegExp characters", function () {
917907
var handler = sinon.spy();
918-
this.server.legacyRoutes = false;
919908
this.server.respondWith("GET", "/hello\\?world", handler);
920909
var xhr = new FakeXMLHttpRequest();
921910
xhr.open("GET", "/hello?world");
@@ -926,18 +915,6 @@ describe("sinonFakeServer", function () {
926915
assert(handler.calledOnce);
927916
});
928917

929-
it("yields response to handler when url contains unescaped RegExp characters in legacy mode", function () {
930-
var handler = sinon.spy();
931-
this.server.respondWith("GET", "/hello?world", handler);
932-
var xhr = new FakeXMLHttpRequest();
933-
xhr.open("GET", "/hello?world");
934-
xhr.send();
935-
936-
this.server.respond();
937-
938-
assert(handler.calledOnce);
939-
});
940-
941918
function equalMatcher(expected) {
942919
return function (test) {
943920
return expected === test;

0 commit comments

Comments
 (0)