@@ -710,7 +710,10 @@ def get_collection_items(
710710
711711 try :
712712 content = formatter .write (
713+ api = api ,
713714 data = content ,
715+ dataset = dataset ,
716+ id_field = (p .uri_field or 'id' ),
714717 options = {
715718 'provider_def' : get_provider_by_type (
716719 collections [dataset ]['providers' ],
@@ -723,7 +726,9 @@ def get_collection_items(
723726 HTTPStatus .INTERNAL_SERVER_ERROR , headers , request .format ,
724727 'NoApplicableCode' , msg )
725728
726- return headers , HTTPStatus .OK , content
729+ headers ['Content-Type' ] = formatter .mimetype
730+
731+ return headers , HTTPStatus .OK , to_json (content , api .pretty_print )
727732
728733 return headers , HTTPStatus .OK , to_json (content , api .pretty_print )
729734
@@ -947,6 +952,11 @@ def get_collection_item(api: API, request: APIRequest,
947952 'title' : l10n .translate ('This document as JSON' , request .locale ),
948953 'href' : f'{ uri } ?f={ F_JSON } '
949954 }, {
955+ 'rel' : request .get_linkrel (F_JSONFG ),
956+ 'type' : FORMAT_TYPES [F_JSONFG ],
957+ 'title' : l10n .translate ('This document as JSON-FG (JSON-FG)' , request .locale ), # noqa
958+ 'href' : f'{ uri } ?f={ F_JSONFG } '
959+ }, {
950960 'rel' : request .get_linkrel (F_JSONLD ),
951961 'type' : FORMAT_TYPES [F_JSONLD ],
952962 'title' : l10n .translate ('This document as RDF (JSON-LD)' , request .locale ), # noqa
@@ -1010,15 +1020,15 @@ def get_collection_item(api: API, request: APIRequest,
10101020 return headers , HTTPStatus .OK , content
10111021
10121022 elif request .format == F_JSONFG :
1013- # content = geojson2jsonfg(
1014- # api, content, dataset, id_field=(p.uri_field or 'id')
1015- # )
10161023 formatter = load_plugin ('formatter' ,
10171024 {'name' : F_JSONFG , 'geom' : True })
10181025
10191026 try :
10201027 content = formatter .write (
1028+ api = api ,
10211029 data = content ,
1030+ dataset = dataset ,
1031+ id_field = (p .uri_field or 'id' ),
10221032 options = {
10231033 'provider_def' : get_provider_by_type (
10241034 collections [dataset ]['providers' ],
@@ -1031,7 +1041,7 @@ def get_collection_item(api: API, request: APIRequest,
10311041 HTTPStatus .INTERNAL_SERVER_ERROR , headers , request .format ,
10321042 'NoApplicableCode' , msg )
10331043
1034- return headers , HTTPStatus .OK , content
1044+ return headers , HTTPStatus .OK , to_json ( content , api . pretty_print )
10351045
10361046 return headers , HTTPStatus .OK , to_json (content , api .pretty_print )
10371047
0 commit comments