Skip to content

Commit a6f977f

Browse files
author
Phil Varner
authored
Pv/fix content types (#362)
1 parent dae3cb9 commit a6f977f

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
### Fixed
1111

12+
- Fixed incorrect usage of `application/geo+json` in several link relations.
1213
- When cross-cluster search is configured, the first search without a collection returned
1314
zero results.
1415

src/lib/api.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -320,19 +320,19 @@ const addCollectionLinks = function (results, endpoint) {
320320
// self link
321321
links.splice(0, 0, {
322322
rel: 'self',
323-
type: 'application/geo+json',
323+
type: 'application/json',
324324
href: `${endpoint}/collections/${id}`
325325
})
326326
// parent catalog
327327
links.push({
328328
rel: 'parent',
329-
type: 'application/geo+json',
329+
type: 'application/json',
330330
href: `${endpoint}`
331331
})
332332
// root catalog
333333
links.push({
334334
rel: 'root',
335-
type: 'application/geo+json',
335+
type: 'application/json',
336336
href: `${endpoint}`
337337
})
338338
// child items
@@ -372,7 +372,7 @@ const addItemLinks = function (results, endpoint) {
372372
// root catalog
373373
links.push({
374374
rel: 'root',
375-
type: 'application/geo+json',
375+
type: 'application/json',
376376
href: `${endpoint}`
377377
})
378378
links.push({
@@ -465,7 +465,8 @@ const buildPaginationLinks = function (limit, parameters, bbox, intersects, endp
465465
const link = {
466466
rel: 'next',
467467
title: 'Next page of Items',
468-
method: httpMethod
468+
method: httpMethod,
469+
type: 'application/geo+json'
469470
}
470471
if (httpMethod === 'GET') {
471472
const nextQueryParameters = dictToURI(nextParams)
@@ -515,9 +516,11 @@ const searchItems = async function (collectionId, queryParameters, backend, endp
515516
})
516517

517518
let newEndpoint = `${endpoint}/search`
519+
let collectionEndpoint
518520
if (collectionId) {
519521
searchParams.collections = [collectionId]
520522
newEndpoint = `${endpoint}/collections/${collectionId}/items`
523+
collectionEndpoint = `${endpoint}/collections/${collectionId}`
521524
}
522525

523526
logger.debug(`Search parameters: ${JSON.stringify(searchParams)}`)
@@ -551,13 +554,18 @@ const searchItems = async function (collectionId, queryParameters, backend, endp
551554
links = paginationLinks.concat([
552555
{
553556
rel: 'self',
554-
type: 'application/json',
555-
href: `${newEndpoint}`
557+
type: 'application/geo+json',
558+
href: newEndpoint
556559
},
557560
{
558561
rel: 'root',
559-
type: 'application/geo+json',
560-
href: `${endpoint}`
562+
type: 'application/json',
563+
href: endpoint
564+
},
565+
{
566+
rel: 'collection',
567+
type: 'application/json',
568+
href: collectionEndpoint
561569
}
562570
])
563571
} else {
@@ -666,7 +674,7 @@ const aggregate = async function (queryParameters, backend, endpoint, httpMethod
666674
},
667675
{
668676
rel: 'root',
669-
type: 'application/geo+json',
677+
type: 'application/json',
670678
href: `${endpoint}`
671679
}]
672680
}
@@ -702,12 +710,12 @@ const getCatalog = async function (txnEnabled, backend, endpoint = '') {
702710
const links = [
703711
{
704712
rel: 'self',
705-
type: 'application/geo+json',
713+
type: 'application/json',
706714
href: `${endpoint}`
707715
},
708716
{
709717
rel: 'root',
710-
type: 'application/geo+json',
718+
type: 'application/json',
711719
href: `${endpoint}`
712720
},
713721
{
@@ -781,7 +789,7 @@ const getCollections = async function (backend, endpoint = '') {
781789
},
782790
{
783791
rel: 'root',
784-
type: 'application/geo+json',
792+
type: 'application/json',
785793
href: `${endpoint}`,
786794
},
787795
],

0 commit comments

Comments
 (0)