diff --git a/dist/functions/server/handle-routes.d.ts b/dist/functions/server/handle-routes.d.ts index 9130e3e..2dd8f87 100644 --- a/dist/functions/server/handle-routes.d.ts +++ b/dist/functions/server/handle-routes.d.ts @@ -1,5 +1,5 @@ type Params = { req: Request; }; -export default function ({ req }: Params): Promise; +export default function ({ req }: Params): Promise; export {}; diff --git a/dist/functions/server/handle-routes.js b/dist/functions/server/handle-routes.js index 7f66133..c7e1ffd 100644 --- a/dist/functions/server/handle-routes.js +++ b/dist/functions/server/handle-routes.js @@ -2,6 +2,7 @@ import grabRouteParams from "../../utils/grab-route-params"; import grabConstants from "../../utils/grab-constants"; import grabRouter from "../../utils/grab-router"; import isDevelopment from "../../utils/is-development"; +import _ from "lodash"; export default async function ({ req }) { const url = new URL(req.url); const is_dev = isDevelopment(); @@ -53,7 +54,10 @@ export default async function ({ req }) { } return res; } - return Response.json(res, { - ...(res.bunext_api_route_res_options || undefined), - }); + if (res) { + return Response.json(_.omit(res, "bunext_api_route_res_options"), { + ...(res.bunext_api_route_res_options || undefined), + }); + } + return undefined; } diff --git a/package.json b/package.json index ee5e790..6a67dc3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/bunext", - "version": "1.0.67", + "version": "1.0.68", "main": "dist/index.js", "module": "index.ts", "dependencies": { diff --git a/src/functions/server/handle-routes.ts b/src/functions/server/handle-routes.ts index 3d7592a..fbb60eb 100644 --- a/src/functions/server/handle-routes.ts +++ b/src/functions/server/handle-routes.ts @@ -7,12 +7,13 @@ import grabRouteParams from "../../utils/grab-route-params"; import grabConstants from "../../utils/grab-constants"; import grabRouter from "../../utils/grab-router"; import isDevelopment from "../../utils/is-development"; +import _ from "lodash"; type Params = { req: Request; }; -export default async function ({ req }: Params): Promise { +export default async function ({ req }: Params): Promise { const url = new URL(req.url); const is_dev = isDevelopment(); @@ -89,7 +90,11 @@ export default async function ({ req }: Params): Promise { return res; } - return Response.json(res, { - ...(res.bunext_api_route_res_options || undefined), - }); + if (res) { + return Response.json(_.omit(res, "bunext_api_route_res_options"), { + ...(res.bunext_api_route_res_options || undefined), + }); + } + + return undefined; }