From 9be0783bbb5dc093118a1ac2efdbda629b73e569 Mon Sep 17 00:00:00 2001 From: Vlad Fedosov Date: Tue, 1 Jun 2021 16:31:25 +0300 Subject: [PATCH] fix: now host detection is in sync with server part of the ILC (#306) --- ilc/client/GuardManager.js | 4 ++-- ilc/client/GuardManager.spec.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ilc/client/GuardManager.js b/ilc/client/GuardManager.js index d7400576..d84c2af3 100644 --- a/ilc/client/GuardManager.js +++ b/ilc/client/GuardManager.js @@ -34,12 +34,12 @@ export default class GuardManager { route: { meta: route.meta, url: route.reqUrl, - hostname: window.location.hostname, + hostname: window.location.host, }, prevRoute: { meta: prevRoute.meta, url: prevRoute.reqUrl, - hostname: window.location.hostname, + hostname: window.location.host, }, navigate: this.#router.navigateToUrl, }); diff --git a/ilc/client/GuardManager.spec.js b/ilc/client/GuardManager.spec.js index a8eac01b..8ecaefc8 100644 --- a/ilc/client/GuardManager.spec.js +++ b/ilc/client/GuardManager.spec.js @@ -93,8 +93,8 @@ describe('GuardManager', () => { for (const hook of hooks) { sinon.assert.calledOnceWithExactly(hook, { - route: {meta: route.meta, url: route.reqUrl, hostname: window.location.hostname}, - prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.hostname}, + route: {meta: route.meta, url: route.reqUrl, hostname: window.location.host}, + prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.host}, navigate: router.navigateToUrl }); } @@ -129,8 +129,8 @@ describe('GuardManager', () => { for (const hook of [hooks[0], hooks[1]]) { sinon.assert.calledOnceWithExactly(hook, { - route: {meta: route.meta, url: route.reqUrl, hostname: window.location.hostname}, - prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.hostname}, + route: {meta: route.meta, url: route.reqUrl, hostname: window.location.host}, + prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.host}, navigate: router.navigateToUrl }); } @@ -159,8 +159,8 @@ describe('GuardManager', () => { for (const hook of [hooks[0], hooks[1]]) { sinon.assert.calledOnceWithExactly(hook, { - route: {meta: route.meta, url: route.reqUrl, hostname: window.location.hostname}, - prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.hostname}, + route: {meta: route.meta, url: route.reqUrl, hostname: window.location.host}, + prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.host}, navigate: router.navigateToUrl }); } @@ -189,8 +189,8 @@ describe('GuardManager', () => { for (const hook of [hooks[0], hooks[1]]) { sinon.assert.calledOnceWithExactly(hook, { - route: {meta: route.meta, url: route.reqUrl, hostname: window.location.hostname}, - prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.hostname}, + route: {meta: route.meta, url: route.reqUrl, hostname: window.location.host}, + prevRoute: {meta: prevRoute.meta, url: prevRoute.reqUrl, hostname: window.location.host}, navigate: router.navigateToUrl }); }