From b8c38550a2e2ffa5b4cd51851353198595770702 Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Tue, 20 Dec 2022 19:41:07 +0000 Subject: [PATCH] Bug 31795: (follow-up) fix header name --- Koha/REST/V1/Authorities.pm | 4 ++-- api/v1/swagger/swagger.yaml | 4 ++-- t/db_dependent/api/v1/authorities.t | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Koha/REST/V1/Authorities.pm b/Koha/REST/V1/Authorities.pm index 109c038273..15a70070dd 100644 --- a/Koha/REST/V1/Authorities.pm +++ b/Koha/REST/V1/Authorities.pm @@ -161,7 +161,7 @@ sub add { $record = MARC::Record->new_from_xml( $body->{marcxml}, 'UTF-8', $flavour ); $authtypecode = $body->{authtypecode}; } else { - $authtypecode = $c->validation->param('authority_type'); + $authtypecode = $c->validation->param('x-authority-type'); if ( $c->req->headers->content_type =~ m/application\/marcxml\+xml/ ) { $record = MARC::Record->new_from_xml( $body, 'UTF-8', $flavour ); } elsif ( $c->req->headers->content_type =~ m/application\/marc-in-json/ ) { @@ -184,7 +184,7 @@ sub add { my ($duplicateauthid,$duplicateauthvalue); ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode); - my $confirm_not_duplicate = $c->validation->param('confirm_not_duplicate'); + my $confirm_not_duplicate = $c->validation->param('x-confirm-not-duplicate'); return $c->render( status => 400, diff --git a/api/v1/swagger/swagger.yaml b/api/v1/swagger/swagger.yaml index f50153b68f..9f6fa66907 100644 --- a/api/v1/swagger/swagger.yaml +++ b/api/v1/swagger/swagger.yaml @@ -348,13 +348,13 @@ parameters: type: integer authority_type_header: description: Authority type code. Use when content type is not application/json - name: authority_type + name: x-authority-type in: header required: false type: string confirm_not_duplicate_header: description: Confirm the posted element is not a duplicate - name: confirm_not_duplicate + name: x-confirm-not-duplicate in: header required: false type: integer diff --git a/t/db_dependent/api/v1/authorities.t b/t/db_dependent/api/v1/authorities.t index b9720163b5..03cd52e58a 100755 --- a/t/db_dependent/api/v1/authorities.t +++ b/t/db_dependent/api/v1/authorities.t @@ -216,15 +216,15 @@ subtest 'post() tests' => sub { ->status_is(200) ->json_has('/id'); - $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marcxml+xml', authority_type => 'CORPO_NAME'} => $marcxml) + $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marcxml+xml', 'x-authority-type' => 'CORPO_NAME'} => $marcxml) ->status_is(200) ->json_has('/id'); - $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc-in-json', authority_type => 'CORPO_NAME'} => $mij) + $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc-in-json', 'x-authority-type' => 'CORPO_NAME'} => $mij) ->status_is(200) ->json_has('/id'); - $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', authority_type => 'CORPO_NAME'} => $marc) + $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', 'x-authority-type' => 'CORPO_NAME'} => $marc) ->status_is(200) ->json_has('/id'); -- 2.25.1