Skip to content

Commit a45f868

Browse files
author
Phil Varner
committed
add test with STAC-Endpoint header
1 parent 87127cd commit a45f868

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/system/test-api-get-root.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,21 @@ test('GET / returns links with the correct endpoint if `X-STAC-Endpoint` is set'
100100
t.is(apiLink.href, `${url}/api`)
101101
})
102102

103+
test('GET / returns links with the correct endpoint if `STAC-Endpoint` is set', async (t) => {
104+
const url = `http://${randomId()}.local`
105+
106+
const response = await t.context.api.client.get('', {
107+
headers: {
108+
'STAC-Endpoint': url
109+
}
110+
})
111+
112+
const apiLink = response.links.find((l) => l.rel === 'service-desc')
113+
114+
t.not(apiLink, undefined)
115+
t.is(apiLink.href, `${url}/api`)
116+
})
117+
103118
test('GET / returns a compressed response if ENABLE_RESPONSE_COMPRESSION', async (t) => {
104119
const response = await t.context.api.client.get('', { resolveBodyOnly: false })
105120

0 commit comments

Comments
 (0)