From 31b3a5c121c476521a27a7f85665ebb4a027eeca Mon Sep 17 00:00:00 2001 From: Izel Nakri Date: Tue, 1 Sep 2020 22:28:32 +0200 Subject: [PATCH 1/2] add prettier config matching code to package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index bf7f26b..57794a6 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,9 @@ } } }, + "prettier": { + "singleQuoute": true + }, "volta": { "node": "14.2.0", "yarn": "1.22.4" From 2fc1259d325a08103de2816a6fcf5c54eeac7f4c Mon Sep 17 00:00:00 2001 From: Izel Nakri Date: Tue, 1 Sep 2020 22:35:52 +0200 Subject: [PATCH 2/2] made pretender.handlerFor public --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 42ef1b1..669b7f8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -132,7 +132,7 @@ Pretender.prototype = { let verb = request.method.toUpperCase(); let path = request.url; - let handler = this._handlerFor(verb, path, request); + let handler = this.handlerFor(verb, path, request); if (handler) { handler.handler.numberOfCalls++; @@ -210,7 +210,7 @@ Pretender.prototype = { } }, requiresManualResolution: function(verb, path) { - let handler = this._handlerFor(verb.toUpperCase(), path, {}); + let handler = this.handlerFor(verb.toUpperCase(), path, {}); if (!handler) { return false; } let async = handler.handler.async; @@ -229,7 +229,7 @@ Pretender.prototype = { path + ' but encountered an error: ' + error.message; throw error; }, - _handlerFor: function(verb, url, request) { + handlerFor: function(verb, url, request) { let registry = this.hosts.forURL(url)[verb]; let matches = registry.recognize(parseURL(url).fullpath);