feat: extend api request builder with custom base url

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-04 16:16:52 +02:00
parent ca586413d2
commit 8977100830
5 changed files with 26 additions and 4 deletions
frontend/src/api/common/api-request-builder

View file

@ -19,6 +19,11 @@ describe('PutApiRequestBuilder', () => {
global.fetch = originalFetch
})
it('uses the custom base url as prefix', async () => {
expectFetch('https://example.org/api/private/test', 200, { method: 'PUT' })
await new PutApiRequestBuilder<string, undefined>('test', 'https://example.org/').sendRequest()
})
describe('sendRequest without body', () => {
it('without headers', async () => {
expectFetch('api/private/test', 200, { method: 'PUT' })