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 <tomascohen@theke.io>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Change sounds reasonable. Tests pass before and after patch.
"grep -r "x-marc-schema" *" confirms no occurrences after patch.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 00629fe94f)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2023-03-23 19:46:48 -03:00 committed by Martin Renvoize
parent 13bf7f1b7d
commit 3a67605dc8
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
3 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -368,7 +368,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

View File

@ -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)