Constructs an instance of SimpleHttpClient with the given base URL, timeout period and HTTP headers. The HTTP headers are used each time this client send a request to the URL, if not overwritten by the HttpParams of the method sending the request.
The base URL for HTTP requests.
Optional
headers: HeadersInit = ...The default headers for HTTP requests.
Optional
timeout: number = SimpleHttpClient.DEFAULT_TIMEOUTThe timeout duration in milliseconds.
Readonly
baseURLReturn the root URL for the API endpoints.
Readonly
headersReadonly
timeoutReturn the amount of time in milliseconds before a timeout occurs when requesting with HTTP methods.
Static
Readonly
DEFAULT_Represent the default timeout duration for network requests in milliseconds.
Sends an HTTP GET request to the specified path with optional query parameters.
The endpoint path to which the HTTP GET request is sent.
Optional
params: HttpParamsOptional parameters for the request, including query parameters, headers, body, and response validation. HttpParams.headers override SimpleHttpClient.headers.
A promise that resolves with the response of the GET request.
Executes an HTTP request with the specified method, path, and optional parameters.
The HTTP method to use for the request (e.g., GET, POST).
The URL path for the request. Leading slashes will be automatically removed.
Optional
params: HttpParamsOptional parameters for the request, including query parameters, headers, body, and response validation. HttpParams.headers override SimpleHttpClient.headers.
A promise that resolves to the response of the HTTP request.
Makes an HTTP POST request to the specified path with optional parameters.
The endpoint to which the POST request is made.
Optional
params: HttpParamsOptional parameters for the request, including query parameters, headers, body, and response validation. HttpParams.headers override SimpleHttpClient.headers.
A promise that resolves with the response from the server.
This class implements the HttpClient interface using the Fetch API.
The SimpleHttpClient allows making HttpMethod requests with timeout and base URL configuration.