From 3be27c262fb1d5d13f74a252ab88a03b6142f92a Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Mon, 28 Nov 2022 17:27:12 +0800 Subject: [PATCH] fix: 404 response (#1156) --- packages/core/actions/src/__tests__/remove-action.test.ts | 6 ++---- packages/core/actions/src/utils.ts | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/actions/src/__tests__/remove-action.test.ts b/packages/core/actions/src/__tests__/remove-action.test.ts index 48b7085f0..1b888ee7f 100644 --- a/packages/core/actions/src/__tests__/remove-action.test.ts +++ b/packages/core/actions/src/__tests__/remove-action.test.ts @@ -96,6 +96,7 @@ describe('remove action', () => { values: [t1.get('id')], }); + expect(response.status).toEqual(200); expect(await p1.countTags()).toEqual(1); }); @@ -112,10 +113,7 @@ describe('remove action', () => { const postProfile = await Profile.repository.findOne(); expect(await postProfile.getPost()).not.toBeNull(); - const response = await app - .agent() - .resource('posts.profile', p1.get('id')) - .remove(); + const response = await app.agent().resource('posts.profile', p1.get('id')).remove(); await postProfile.reload(); expect(await postProfile.getPost()).toBeNull(); diff --git a/packages/core/actions/src/utils.ts b/packages/core/actions/src/utils.ts index a52470a4b..8ba71cce3 100644 --- a/packages/core/actions/src/utils.ts +++ b/packages/core/actions/src/utils.ts @@ -16,6 +16,8 @@ export function RelationRepositoryActionBuilder(method: 'remove' | 'set') { const repository = getRepositoryFromParams(ctx); await repository[method](ctx.action.params.values); + + ctx.status = 200; await next(); }; }