From 6eb5d34df64e84d29a790c55478fe0796a34768c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 23 Mar 2023 19:46:48 -0300 Subject: [PATCH] Bug 33328: Rename x-marc-schema => x-record-schema This patch renames the header on the biblio API so it is not entirely tied to MARC, trying to follow the biblio_metadata table generic approach. To test: 1. Apply this patch 2. Run: $ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass 3. You agree with the change? 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Biblios.pm | 4 ++-- api/v1/swagger/swagger.yaml | 2 +- t/db_dependent/api/v1/biblios.t | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 9227a6af8a4..ed071a5dc54 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -493,7 +493,7 @@ sub add { try { my $headers = $c->req->headers; - my $flavour = $headers->header('x-marc-schema'); + my $flavour = $headers->header('x-record-schema'); $flavour //= C4::Context->preference('marcflavour'); my $record; @@ -568,7 +568,7 @@ sub update { try { my $headers = $c->req->headers; - my $flavour = $headers->header('x-marc-schema'); + my $flavour = $headers->header('x-record-schema'); $flavour //= C4::Context->preference('marcflavour'); my $frameworkcode = $headers->header('x-framework-id') || $biblio->frameworkcode; diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index 6f7d6972ab9..2967f20ee12 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -382,7 +382,7 @@ parameters: type: string marc_schema_header: description: March schema. One of MARC21 or UNIMARC - name: x-marc-schema + name: x-record-schema in: header required: false type: string diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t index afff055e360..8be6b4b56ef 100755 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -1125,8 +1125,8 @@ subtest 'post() tests' => sub { } ); - $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode, "x-marc-schema" => 'INVALID'}) - ->status_is(400, 'Invalid header x-marc-schema'); + $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode, "x-record-schema" => 'INVALID'}) + ->status_is(400, 'Invalid header x-record-schema'); $t->post_ok("//$userid:$password@/api/v1/biblios" => {'Content-Type' => 'application/marcxml+xml', 'x-framework-id' => $frameworkcode} => $marcxml) ->status_is(200) -- 2.40.0