Skip to content

Commit bb014b8

Browse files
committed
fix: manually transform the response from the router endpoint
1 parent d5ce6ca commit bb014b8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

.changeset/stupid-ties-wait.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"strapi-plugin-webtools": patch
3+
---
4+
5+
fix: manually transform the response from the router endpoint

packages/core/server/controllers/core.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ export default {
3535

3636
// Format response.
3737
const sanitizedEntity = await sanitizeOutput(responseEntity, contentTypeObj, auth);
38-
ctx.body = await strapi.controller(contentType as UID.Controller)
39-
// @ts-expect-error
40-
// The strapi object is typed in a way that the following is expected to be a controller.
41-
// In fact that is not true, as this also exposes the helper functions of the controller.
42-
// That is the reason we put a ts-expect-error here.
43-
.transformResponse(sanitizedEntity, {});
38+
ctx.body = {
39+
data: sanitizedEntity,
40+
meta: {},
41+
};
4442
},
4543
};

0 commit comments

Comments
 (0)