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>
This commit is contained in:
Tomás Cohen Arazi 2023-03-23 19:46:48 -03:00
parent a3a58b93c3
commit 00629fe94f
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
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

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

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)