diff --git a/src/rices/rices.service.ts b/src/rices/rices.service.ts index 707f2a0..469d162 100644 --- a/src/rices/rices.service.ts +++ b/src/rices/rices.service.ts @@ -145,11 +145,9 @@ export class RicesService { ) { try { // Extract fields from headers - const name = headers['x-zen-rice-name']; - const author = headers['x-zen-rice-author']; const userAgent = headers['user-agent']; - if (!name || !author || !userAgent) { + if (!userAgent) { throw new BadRequestException( 'Missing required headers: X-Zen-Rice-Name, X-Zen-Rice-Author, and User-Agent are mandatory.', ); @@ -178,13 +176,6 @@ export class RicesService { throw new UnauthorizedException('Invalid token.'); } - // Validate name and author match the existing record - if (rice.name !== name || rice.author !== author) { - throw new UnauthorizedException( - 'Provided name and author do not match the existing record.', - ); - } - const updatedMetadata = { ...rice, version, diff --git a/test/restclient/01_create_rice.http b/test/restclient/01_create_rice.http index d19bfcc..c365d12 100644 --- a/test/restclient/01_create_rice.http +++ b/test/restclient/01_create_rice.http @@ -2,7 +2,7 @@ POST {{baseUrl}}/rices Content-Type: application/json -X-Zen-Rice-Name: cool-zenrice-aurora +X-Zen-Rice-Name: cool-zenrice-aurora2 X-Zen-Rice-Author: jhon@doe.com User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64) diff --git a/test/restclient/02_download_rice.http b/test/restclient/02_download_rice.http index 68c019a..94785fe 100644 --- a/test/restclient/02_download_rice.http +++ b/test/restclient/02_download_rice.http @@ -1,5 +1,5 @@ @baseUrl = http://localhost:3000 -@previous_slug = cool-zenrice-aurora-249dd7f2-d669-4d1f-892c-df4caa6fcbfe +@previous_slug = cool-zenrice-aurora2-4fe6417d-f901-43d2-92fc-720c6ed3e449 GET {{baseUrl}}/rices/{{previous_slug}} \ No newline at end of file diff --git a/test/restclient/03_update_rice.http b/test/restclient/03_update_rice.http index 8c347e8..4538380 100644 --- a/test/restclient/03_update_rice.http +++ b/test/restclient/03_update_rice.http @@ -1,11 +1,11 @@ @baseUrl = http://localhost:3000 -@previous_slug = cool-zenrice-aurora-249dd7f2-d669-4d1f-892c-df4caa6fcbfe -@previous_token = 528bb297-274f-4fe1-87f1-956b9b26e0df +@previous_slug = cool-zenrice-aurora2-4fe6417d-f901-43d2-92fc-720c6ed3e449 +@previous_token = e3ec0c0f-f455-4a4e-a06d-69d2e3bbf46c PUT {{baseUrl}}/rices/{{previous_slug}} Content-Type: application/json x-zen-rices-token: {{previous_token}} -X-Zen-Rice-Name: cool-zenrice-aurora +X-Zen-Rice-Name: cool-zenrice-aurora2 X-Zen-Rice-Author: jhon@doe.com User-Agent: ZenBrowser/1.0.0 (EndeavourOS x86_64)