Bugzilla – Attachment 78565 Details for
Bug 21334
Add bibliographic content type definitions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21334: Add bibliographic content type definitions
Bug-21334-Add-bibliographic-content-type-definitio.patch (text/plain), 1.87 KB, created by
Tomás Cohen Arazi
on 2018-09-11 18:38:34 UTC
(
hide
)
Description:
Bug 21334: Add bibliographic content type definitions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2018-09-11 18:38:34 UTC
Size:
1.87 KB
patch
obsolete
>From a5a924092fc3a5eba9c9ae66901ab29c733c9d19 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 11 Sep 2018 10:48:15 -0700 >Subject: [PATCH] Bug 21334: Add bibliographic content type definitions > >This patch adds the following content type definitions, to be used by >endpoint authors implementing MARC-related endpoints: > >-------------------------------------- >| Content-type | Alias | >|--------------------------|---------| >| application/marcxml+xml | marcxml | >| application/marc-in-json | mij | >| application/marc | marc | >-------------------------------------- > >Code using this aliases will use them like this: >- Suppose you want to output data in MARCXML format: > >my $record = cool_method_that_returns_MARC_RECORD(); >return $c->render( status => 200, format => 'marcxml', text => $record->as_xml_record ); > >Note: 'text' by defaults encodes output as UTF-8. If the encoding is not >UTF-8 you should encode the data on your own. > >To test: >- Apply this patches >- Run: > $ kshell > k$ prove t/db_dependent/Koha/REST/V1.t >=> SUCCESS: Test pass! >- Sign off :-D >--- > Koha/REST/V1.pm | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index 2c9491150a..b1f4657d4a 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -45,7 +45,12 @@ sub startup { > }); > > # Force charset=utf8 in Content-Type header for JSON responses >- $self->types->type(json => 'application/json; charset=utf8'); >+ $self->types->type( json => 'application/json; charset=utf8' ); >+ # MARC-related types >+ $self->types->type( marcxml => 'application/marcxml+xml' ); >+ $self->types->type( mij => 'application/marc-in-json' ); >+ $self->types->type( marc => 'application/marc' ); >+ > > my $secret_passphrase = C4::Context->config('api_secret_passphrase'); > if ($secret_passphrase) { >-- >2.19.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21334
:
78563
|
78564
|
78565
|
78585
|
78599
|
78600