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 Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
1442499a0b
commit
b612ec7a0d
1 changed files with 6 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue