Update API routes function pass #3
This commit is contained in:
+8
-1
@@ -55,9 +55,16 @@ export default async function ({ req }) {
|
||||
return res;
|
||||
}
|
||||
if (res) {
|
||||
return Response.json(_.omit(res, "bunext_api_route_res_options"), {
|
||||
let final_res = Response.json(_.omit(res, [
|
||||
"bunext_api_route_res_options",
|
||||
"bunext_api_route_res_transform_fn",
|
||||
]), {
|
||||
...(res.bunext_api_route_res_options || undefined),
|
||||
});
|
||||
if (res.bunext_api_route_res_transform_fn) {
|
||||
final_res = await res.bunext_api_route_res_transform_fn(final_res);
|
||||
}
|
||||
return final_res;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user