From 00629fe94f728fda4d24a64855ed2768a88e0357 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 Signed-off-by: Magnus Enger Change sounds reasonable. Tests pass before and after patch. "grep -r "x-marc-schema" *" confirms no occurrences after patch. Signed-off-by: Martin Renvoize 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 baf9d943be..9b4750b65e 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -496,7 +496,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; @@ -571,7 +571,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 7d5e04f62d..10e09cbc8b 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -384,7 +384,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 d074084238..de45fe0eeb 100755 --- a/t/db_dependent/api/v1/biblios.t +++ b/t/db_dependent/api/v1/biblios.t @@ -1156,8 +1156,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.39.5