Comparing version 3.0.11 to 3.0.12
@@ -30,3 +30,3 @@ "use strict"; | ||
const handlerResolver = (context, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
const nextIfMiddlewareExist = () => { | ||
@@ -45,3 +45,3 @@ if (post.length) | ||
const response = yield handler(context); | ||
const responseValidation = yield schema.response.safeParseAsync("body" in response ? response.body : ""); | ||
const responseValidation = yield schema.response.safeParseAsync("body" in response ? response.body : null); | ||
if (!responseValidation.success) { | ||
@@ -52,4 +52,4 @@ console.warn(errors_1.Errors.RESPONSE_MISMATCH); | ||
} | ||
context.body = responseValidation.data; | ||
context.status = (_b = response.status) !== null && _b !== void 0 ? _b : 200; | ||
context.body = (_b = responseValidation.data) !== null && _b !== void 0 ? _b : undefined; | ||
context.status = (_c = response.status) !== null && _c !== void 0 ? _c : 200; | ||
for (const [key, value] of Object.entries(response.headers || {})) | ||
@@ -56,0 +56,0 @@ context.set(key, value.toString()); |
@@ -58,3 +58,3 @@ import Router from "koa-router"; | ||
const responseValidation = await schema.response.safeParseAsync( | ||
"body" in response ? response.body : "" | ||
"body" in response ? response.body : null | ||
); | ||
@@ -68,3 +68,3 @@ | ||
context.body = responseValidation.data; | ||
context.body = responseValidation.data ?? undefined; | ||
context.status = response.status ?? 200; | ||
@@ -71,0 +71,0 @@ |
{ | ||
"name": "18h", | ||
"description": "A Next.js style dynamic API router for Koa-based APIs.", | ||
"version": "3.0.11", | ||
"version": "3.0.12", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "url": "https://github.com/ridafkih/18h" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40952