Skip to content

Commit 26b7636

Browse files
committed
Removes 'Content-Type' header from GET requests leaving it only on POST
1 parent 48dcba0 commit 26b7636

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/stac-api/StacApi.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ describe('StacApi', () => {
101101
'https://api.example.com/search?collections=sentinel-2-l2a&datetime=2025-12-01%2F2025-12-31',
102102
expect.objectContaining({
103103
method: 'GET',
104-
headers: expect.objectContaining({
105-
'Content-Type': 'application/json',
106-
}),
107104
})
108105
);
109106
});

src/stac-api/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,8 @@ class StacApi {
9292
return fetch(url, {
9393
method,
9494
headers: {
95-
'Content-Type': 'application/json',
96-
...headers,
9795
...this.options?.headers,
96+
...headers,
9897
},
9998
body: payload ? JSON.stringify(payload) : undefined,
10099
});
@@ -114,7 +113,7 @@ class StacApi {
114113
return this.fetch(`${this.baseUrl}/search`, {
115114
method: 'POST',
116115
payload: requestPayload,
117-
headers,
116+
headers: { 'Content-Type': 'application/json', ...headers },
118117
});
119118
} else {
120119
const query = this.payloadToQuery(requestPayload);

0 commit comments

Comments
 (0)