From 6d8999dbf5780e9e0812ab7c09243309cc05f760 Mon Sep 17 00:00:00 2001 From: sianida26 Date: Fri, 1 Mar 2024 21:04:57 +0700 Subject: [PATCH] Add typecheck --- src/core/utils/onlyAllowFollowingContentType.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/utils/onlyAllowFollowingContentType.ts b/src/core/utils/onlyAllowFollowingContentType.ts index b63b9c7..715e1ab 100644 --- a/src/core/utils/onlyAllowFollowingContentType.ts +++ b/src/core/utils/onlyAllowFollowingContentType.ts @@ -1,5 +1,6 @@ import { headers } from "next/headers"; import BaseError from "../error/BaseError"; +import ContentType from "@/types/ContentType"; /** * Ensures that the current request's content type is one of the allowed types. @@ -9,7 +10,7 @@ import BaseError from "../error/BaseError"; * @throws {BaseError} Throws a BaseError if the current request's content type is not in the allowed content types. */ export default function onlyAllowFollowingContentType( - contentTypes: string | string[] + contentTypes: ContentType & (string | {}) | ContentType[] | (string | {})[] ) { // Retrieve the current request's content type. const currentContentType = headers().get("Content-Type");