Skip to content

Commit bba8508

Browse files
caybloodclaude
andcommitted
Fix async handling in router controller
Add await keyword before transformResponse call to properly handle the Promise returned by the method. This resolves the issue where the router endpoint returns empty objects instead of the expected content. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 08c0017 commit bba8508

File tree

1 file changed

+1
-1
lines changed
  • packages/core/server/controllers

1 file changed

+1
-1
lines changed

packages/core/server/controllers/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default {
3535

3636
// Format response.
3737
const sanitizedEntity = await sanitizeOutput(responseEntity, contentTypeObj, auth);
38-
ctx.body = strapi.controller(contentType as UID.Controller)
38+
ctx.body = await strapi.controller(contentType as UID.Controller)
3939
// @ts-expect-error
4040
// The strapi object is typed in a way that the following is expected to be a controller.
4141
// In fact that is not true, as this also exposes the helper functions of the controller.

0 commit comments

Comments
 (0)