Skip to content

Commit a186e94

Browse files
committed
set f= in next/prev links (#2175)
1 parent bf7c6ca commit a186e94

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

pygeoapi/api/itemtypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,12 @@ def get_collection_items(
623623
'type': 'application/geo+json',
624624
'rel': 'prev',
625625
'title': l10n.translate('Items (prev)', request.locale),
626-
'href': f'{uri}?offset={prev}{serialized_query_params}'
626+
'href': f'{uri}?f={F_JSON}&offset={prev}{serialized_query_params}' # noqa
627627
})
628628

629629
if next_link:
630630
next_ = offset + limit
631-
next_href = f'{uri}?offset={next_}{serialized_query_params}'
631+
next_href = f'{uri}?f={F_JSON}&offset={next_}{serialized_query_params}'
632632
content['links'].append(
633633
{
634634
'type': 'application/geo+json',

tests/api/test_itemtypes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_get_collection_items(config, api_):
256256
assert links[2]['rel'] == 'alternate'
257257
assert '/collections/obs/items?f=csv' in links[3]['href']
258258
assert links[3]['rel'] == 'alternate'
259-
assert '/collections/obs/items?offset=0' in links[4]['href']
259+
assert '/collections/obs/items?f=json&offset=0' in links[4]['href']
260260
assert links[4]['rel'] == 'prev'
261261
assert '/collections/obs' in links[5]['href']
262262
assert links[5]['rel'] == 'collection'
@@ -285,8 +285,7 @@ def test_get_collection_items(config, api_):
285285
assert '/collections/obs/items?f=csv&limit=1&bbox=-180,-90,180,90' \
286286
in links[3]['href']
287287
assert links[3]['rel'] == 'alternate'
288-
assert '/collections/obs/items?offset=0&limit=1&bbox=-180,-90,180,90' \
289-
in links[4]['href']
288+
assert '/collections/obs/items?f=json&offset=0&limit=1&bbox=-180,-90,180,90' in links[4]['href'] # noqa
290289
assert links[4]['rel'] == 'prev'
291290
assert '/collections/obs' in links[5]['href']
292291
assert links[4]['rel'] == 'prev'

0 commit comments

Comments
 (0)