Skip to content

Commit

Permalink
The search link MUST be 'application/geo+json' as otherwise it's like…
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 22, 2023
1 parent 3c38f62 commit 8bfbabb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/models/stac.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Utils from "../utils";
import Utils, { geojsonMediaType } from "../utils";
import Migrate from '@radiantearth/stac-migrate';
import { getBest } from '../locale-id';

Expand Down Expand Up @@ -145,7 +145,10 @@ class STAC {
}

getSearchLink() {
let links = this.getStacLinksWithRel('search');
// The search link MUST be 'application/geo+json' as otherwise it's likely not STAC
// See https://github.com/opengeospatial/ogcapi-features/issues/832
let links = Utils.getLinksWithRels(this.links, ['search'])
.filter(link => Utils.isMediaType(link.type, geojsonMediaType));
// Prefer POST if present
let post = links.find(link => Utils.hasText(link.method) && link.method.toUpperCase() === 'POST');
return post || links[0] || null;
Expand Down

0 comments on commit 8bfbabb

Please sign in to comment.