FetchService
Stentor API Reference / stentor-service-fetch/src / FetchService
Abstract Class: FetchService
Defined in: packages/stentor-service-fetch/src/FetchService.ts:33
Abstract service for services that primarily rely on the fetch API.
It includes built-in timeout feature to better keep track of external APIs.
Exportβ
FetchService
Extendsβ
Constructorsβ
Constructorβ
new FetchService(
props?):FetchService
Defined in: packages/stentor-service-fetch/src/AbstractService.ts:13
Parametersβ
props?β
BaseService
Returnsβ
FetchService
Inherited fromβ
Propertiesβ
timeoutβ
readonlytimeout:number=1000
Defined in: packages/stentor-service-fetch/src/AbstractService.ts:9
Timeout
Inherited fromβ
retryAttemptsβ
readonlyretryAttempts:number=0
Defined in: packages/stentor-service-fetch/src/AbstractService.ts:10
How many attempts to make on the API
Inherited fromβ
logsβ
readonlylogs:boolean=false
Defined in: packages/stentor-service-fetch/src/AbstractService.ts:11
Log information from the service
Inherited fromβ
Methodsβ
fetch()β
protectedfetch(url,options?):Promise\<Response>
Defined in: packages/stentor-service-fetch/src/FetchService.ts:39
Wrapper around fetch to add some basic diagnostics
Will throw a TimeoutError if the timeout is reached.
Parametersβ
urlβ
string
options?β
RequestInit & WithTimeout
Returnsβ
Promise\<Response>