Junior — Senior
HTTP request function with automatic retries and time limit
livecode
Task condition
It is required to write a function retryFetch that takes the following arguments:
endpoint— the URL to which the HTTP request will be sent;maxRetries— the number of attempts to retry the request in case of failure;requestTimeout— the maximum duration to wait for a response for each individual attempt. The function should perform afetchrequest to the specifiedendpointand, in case of an error or timeout, retry it until it receives a successful response or exhausts the number of attemptsmaxRetries. Upon successful completion, the request should return the received data converted to JSON. If after all attempts the request fails, it should throw the last encountered error.