mirror of
https://github.com/zen-browser/rices.git
synced 2025-07-07 17:05:40 +02:00
- Changed create and update method. Headers+body instead of DTO
- Added token validation for `update` and `remove` operations to ensure it matches the record in the database. - Ensured `name` and `author` from headers in `update` are validated against the existing record. - Improved error handling for mismatched or missing tokens, returning appropriate HTTP status codes.
This commit is contained in:
parent
c8ce6e7637
commit
121ccadf57
8 changed files with 328 additions and 151 deletions
|
@ -87,7 +87,7 @@ describe('Rices API E2E', () => {
|
|||
|
||||
const updateResponse = await request(app.getHttpServer())
|
||||
.put(`/rices/${slug}`)
|
||||
.set('x-rices-token', token)
|
||||
.set('x-zen-rices-token', token)
|
||||
.field('name', 'Updated Rice')
|
||||
.attach('file', path.join(__dirname, 'files', 'example_update.zenrice'))
|
||||
.expect(200);
|
||||
|
@ -116,7 +116,7 @@ describe('Rices API E2E', () => {
|
|||
|
||||
await request(app.getHttpServer())
|
||||
.delete(`/rices/${slug}`)
|
||||
.set('x-rices-token', token)
|
||||
.set('x-zen-rices-token', token)
|
||||
.expect(204);
|
||||
|
||||
const riceInDatabase = await supabaseService.getRiceBySlug(slug);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue