File size: 445 Bytes
b39afbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Copyright (c) 2023 MERCENARIES.AI PTE. LTD.
 * All rights reserved.
 */

export class HTTPClient {
  fetch: Function;
  constructor(
    fetchFn: Function = (input: RequestInfo | URL, init?: RequestInit | undefined): Promise<Response> =>
      window.fetch(input, init)
  ) {
    this.fetch = fetchFn;
  }

  async executeRequest(input: RequestInfo | URL, init?: RequestInit | undefined) {
    return await this.fetch(input, init);
  }
}