From a0be08d559baa62294a20191b4fbfd8b6ca7d23e Mon Sep 17 00:00:00 2001 From: array-in-a-matrix Date: Mon, 12 Aug 2024 15:11:31 -0400 Subject: [PATCH] respErr with custom http code --- src/helpers.nim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/helpers.nim b/src/helpers.nim index 177c21a..64a0336 100644 --- a/src/helpers.nim +++ b/src/helpers.nim @@ -1,3 +1,5 @@ +import std/httpcore + template H*(s: string): untyped = $request.headers[s] @@ -8,3 +10,7 @@ template reqInfo*: string = template respErr*(s: string): untyped = error s & reqInfo resp Http403, s + +template respErr*(e: HttpCode, s: string): untyped = + error s & reqInfo + resp e, s