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

View file

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