Biblio and authority records need some content-type definitions to be added to the Mojolicious startup code: - 'application/marcxml+xml' - 'application/marc-in-json' - 'application/marc'
Created attachment 78563 [details] [review] Bug 21334: Unit tests This patch adds unit tests for the new content types being added. It also adds tests for the 'json' overloading that already takes place in V1.pm.
Created attachment 78564 [details] [review] 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, 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
Created attachment 78565 [details] [review] 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
Fixed minor mistake on usage explanation.
Created attachment 78585 [details] [review] 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@gail.com>
Created attachment 78599 [details] [review] Bug 21334: Unit tests This patch adds unit tests for the new content types being added. It also adds tests for the 'json' overloading that already takes place in V1.pm. Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 78600 [details] [review] 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>
Awesome work all! Pushed to master for 18.11
Enhancement, will not be backported to 18.05.x series.
Pushed to 18.05.x for 18.05.04. After pushing bug 21116 I decided this one warranted backporting for the same reasons outlined on that bug.
Enhancement not pushed to 17.11.x
(In reply to Josef Moravec from comment #7) > Created attachment 78600 [details] [review] [review] > 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 <https://whatstatus.co/guess-ill-die> > > Signed-off-by: Josef Moravec <josef.moravec@gmail.com> After pushing bug 21116 I decided this one warranted backporting for the same reasons outlined on that bug.