From e984157d1ba137298df9c86e3d1380ee055e3169 Mon Sep 17 00:00:00 2001 From: Martin Folkeseth Date: Thu, 22 Apr 2021 21:49:28 +0200 Subject: [PATCH] Allow usage of plugin prefix on @eik/service We need to to use Fastify plugin prefix https://www.fastify.io/docs/latest/Plugins/#route-prefixing-options and thus append pathname to host rather than replace. In the current situation this request will erase the path and directly append `pathname` after hostname/prococol. This proposal would append `auth/login` to the full server path given by the cli. If no plugin prefix is used, it will work with the default setup as it is today. This proposal will allow: ``` eik login --server http://localhost:4001/with/some/prefix ``` --- classes/login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/login.js b/classes/login.js index 0dabe73a..a23cd80f 100644 --- a/classes/login.js +++ b/classes/login.js @@ -29,7 +29,7 @@ module.exports = class Login { const { message } = await request({ host: this.server, method: 'POST', - pathname: '/auth/login', + pathname: 'auth/login', data: { key: this.key }, });