fix(backend): DELETE /webhooks/:id returns 204 No Content
Matches REST convention and the frontend api-client's existing 204 fast-path, avoiding a JSON-parse crash on an empty response body.
This commit is contained in:
1 parent
59fdc816a0
commit
2458927d38
2 files changed
+11
-2
No files matched your search
@@ -1,4 +1,12 @@
|
|||||||
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
import {
|
||||||
|
Body,
|
||||||
|
Controller,
|
||||||
|
Delete,
|
||||||
|
Get,
|
||||||
|
HttpCode,
|
||||||
|
Param,
|
||||||
|
Post,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||||
import { Role } from '../../generated/prisma';
|
import { Role } from '../../generated/prisma';
|
||||||
import { Roles } from '../auth/decorators/roles.decorator';
|
import { Roles } from '../auth/decorators/roles.decorator';
|
||||||
@@ -28,6 +36,7 @@ export class WebhooksController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
|
@HttpCode(204)
|
||||||
delete(@Param('id') id: string, @CurrentUser() actor: AuthenticatedUser) {
|
delete(@Param('id') id: string, @CurrentUser() actor: AuthenticatedUser) {
|
||||||
return this.webhooksService.delete(id, actor.id);
|
return this.webhooksService.delete(id, actor.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,6 @@ describe('Webhooks (e2e)', () => {
|
|||||||
return request(app.getHttpServer())
|
return request(app.getHttpServer())
|
||||||
.delete(`/api/v1/webhooks/${subscriptionId}`)
|
.delete(`/api/v1/webhooks/${subscriptionId}`)
|
||||||
.set('Authorization', `Bearer ${adminAccessToken}`)
|
.set('Authorization', `Bearer ${adminAccessToken}`)
|
||||||
.expect(200);
|
.expect(204);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user