From c82f569ccd48b00840c0ab5b5a6fafd95a26e9fb Mon Sep 17 00:00:00 2001 From: Fabrice <72084368+fabhoarau@users.noreply.github.com> Date: Sun, 18 Apr 2021 22:44:01 +0200 Subject: [PATCH] Fix bug trailing slash to the prefix Closes #422 --- src/libs/server.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libs/server.ts b/src/libs/server.ts index a8a3942..cdecf95 100644 --- a/src/libs/server.ts +++ b/src/libs/server.ts @@ -267,12 +267,10 @@ export class MockoonServer extends (EventEmitter as new () => TypedEmitter< // only launch non duplicated routes, or ignore if none. if (declaredRoute.enabled) { try { - const routePath = - '/' + - (this.environment.endpointPrefix - ? this.environment.endpointPrefix + '/' - : '') + - declaredRoute.endpoint.replace(/ /g, '%20'); + let routePath = `/${ + this.environment.endpointPrefix + }/${declaredRoute.endpoint.replace(/ /g, '%20')}`; + routePath = routePath.replace('//', ''); // create route server[declaredRoute.method](