Skip to content

Commit 575da0f

Browse files
committed
feat: Specify Stac API request headers
1 parent 99e0ffd commit 575da0f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/stac-api/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ type FetchOptions = {
1010

1111
class StacApi {
1212
baseUrl: string;
13+
options?: GenericObject;
1314

14-
constructor(baseUrl: string) {
15+
constructor(baseUrl: string, options?: GenericObject) {
1516
this.baseUrl = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
17+
this.options = options;
1618
}
1719

1820
fixBboxCoordinateOrder(bbox?: Bbox): Bbox | undefined {
@@ -79,7 +81,8 @@ class StacApi {
7981
method,
8082
headers: {
8183
'Content-Type': 'application/json',
82-
...headers
84+
...headers,
85+
...this.options?.headers
8386
},
8487
body: payload ? JSON.stringify(payload) : undefined
8588
}).then(async (response) => {

0 commit comments

Comments
 (0)