View | Details | Raw Unified | Return to bug 31795
Collapse All | Expand All

(-)a/Koha/REST/V1/Authorities.pm (-2 / +2 lines)
Lines 161-167 sub add { Link Here
161
            $record = MARC::Record->new_from_xml( $body->{marcxml}, 'UTF-8', $flavour );
161
            $record = MARC::Record->new_from_xml( $body->{marcxml}, 'UTF-8', $flavour );
162
            $authtypecode = $body->{authtypecode};
162
            $authtypecode = $body->{authtypecode};
163
        } else {
163
        } else {
164
            $authtypecode = $c->validation->param('authority_type');
164
            $authtypecode = $c->validation->param('x-authority-type');
165
            if ( $c->req->headers->content_type =~ m/application\/marcxml\+xml/ ) {
165
            if ( $c->req->headers->content_type =~ m/application\/marcxml\+xml/ ) {
166
                $record = MARC::Record->new_from_xml( $body, 'UTF-8', $flavour );
166
                $record = MARC::Record->new_from_xml( $body, 'UTF-8', $flavour );
167
            } elsif ( $c->req->headers->content_type =~ m/application\/marc-in-json/ ) {
167
            } elsif ( $c->req->headers->content_type =~ m/application\/marc-in-json/ ) {
Lines 184-190 sub add { Link Here
184
        my ($duplicateauthid,$duplicateauthvalue);
184
        my ($duplicateauthid,$duplicateauthvalue);
185
            ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode);
185
            ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode);
186
186
187
        my $confirm_not_duplicate = $c->validation->param('confirm_not_duplicate');
187
        my $confirm_not_duplicate = $c->validation->param('x-confirm-not-duplicate');
188
188
189
        return $c->render(
189
        return $c->render(
190
            status  => 400,
190
            status  => 400,
(-)a/api/v1/swagger/swagger.yaml (-2 / +2 lines)
Lines 348-360 parameters: Link Here
348
    type: integer
348
    type: integer
349
  authority_type_header:
349
  authority_type_header:
350
    description: Authority type code. Use when content type is not application/json
350
    description: Authority type code. Use when content type is not application/json
351
    name: authority_type
351
    name: x-authority-type
352
    in: header
352
    in: header
353
    required: false
353
    required: false
354
    type: string
354
    type: string
355
  confirm_not_duplicate_header:
355
  confirm_not_duplicate_header:
356
    description: Confirm the posted element is not a duplicate
356
    description: Confirm the posted element is not a duplicate
357
    name: confirm_not_duplicate
357
    name: x-confirm-not-duplicate
358
    in: header
358
    in: header
359
    required: false
359
    required: false
360
    type: integer
360
    type: integer
(-)a/t/db_dependent/api/v1/authorities.t (-4 / +3 lines)
Lines 216-230 subtest 'post() tests' => sub { Link Here
216
      ->status_is(200)
216
      ->status_is(200)
217
      ->json_has('/id');
217
      ->json_has('/id');
218
218
219
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marcxml+xml', authority_type => 'CORPO_NAME'} => $marcxml)
219
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marcxml+xml', 'x-authority-type' => 'CORPO_NAME'} => $marcxml)
220
      ->status_is(200)
220
      ->status_is(200)
221
      ->json_has('/id');
221
      ->json_has('/id');
222
222
223
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc-in-json', authority_type => 'CORPO_NAME'} => $mij)
223
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc-in-json', 'x-authority-type' => 'CORPO_NAME'} => $mij)
224
      ->status_is(200)
224
      ->status_is(200)
225
      ->json_has('/id');
225
      ->json_has('/id');
226
226
227
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', authority_type => 'CORPO_NAME'} => $marc)
227
    $t->post_ok("//$userid:$password@/api/v1/authorities" => {'Content-Type' => 'application/marc', 'x-authority-type' => 'CORPO_NAME'} => $marc)
228
      ->status_is(200)
228
      ->status_is(200)
229
      ->json_has('/id');
229
      ->json_has('/id');
230
230
231
- 

Return to bug 31795