From 2bf8fa38436e3d7808b37e45346ad70520593ab2 Mon Sep 17 00:00:00 2001 From: SeanCassiere <33615041+SeanCassiere@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:52:18 +1200 Subject: [PATCH] refactor: adding the server context types in the middleware --- src/utils/server-helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/server-helpers.ts b/src/utils/server-helpers.ts index d1bd77f..aa28fd5 100644 --- a/src/utils/server-helpers.ts +++ b/src/utils/server-helpers.ts @@ -48,10 +48,10 @@ async function getService(serviceId: string, opts = { mustBeAdmin: false }) { return service ?? null; } -const factory = createFactory(); +const factory = createFactory(); /** - * Middleware to validate that a service ID is provided and that the service exists + * V2 implementation of the middleware to validate that a service request by the service ID in the "x-app-service-id" header */ export const v2_serviceValidation = factory.createMiddleware(async (c, next) => { const serviceId = getServiceId(c); @@ -76,7 +76,7 @@ export const v2_serviceValidation = factory.createMiddleware(async (c, next) => * Middleware to validate that a service ID is provided and that the service exists and is an admin service */ export const adminServiceValidation = factory.createMiddleware(async (c, next) => { - const service = c.var.service as ServerContext["Variables"]["service"]; + const service = c.var.service; if (!service) { c.status(403);