dist/src/http.js
function fetchWithRetry(url, options) {
    async function fetchWrapper() {
        const response = await fetch(url, options);
        // don't retry if status is 4xx
        if (response.status >= 400 && response.status < 500) {
            const contentType = response.headers.get('content-type');
            if (contentType && contentType.includes('application/json')) {
                const body = await response.json();
                throw new p_retry_1.default.AbortError(body.message);
            }
            else {
                throw new p_retry_1.default.AbortError(response.statusText);
            }
        }
        return response;
    }
    return p_retry_1.default(fetchWrapper, { retries: RETRY_COUNT });
}
function fetchWithRetry(url, options) {
    async function fetchWrapper() {
        const response = await fetch(url, options);
        // don't retry if status is 4xx
        if (response.status >= 400 && response.status < 500) {
            const contentType = response.headers.get('content-type');
            if (contentType && contentType.includes('application/json')) {
                const body = await response.json();
                throw new p_retry_1.default.AbortError(body.message);
            }
            else {
                throw new p_retry_1.default.AbortError(response.statusText);
            }
        }
        return response;
    }
    return p_retry_1.default(fetchWrapper, { retries: RETRY_COUNT });
}
function fetchWithRetry ( url , options ) { async function fetchWrapper ( ) { const response = await fetch ( url , options ) ; // don't retry if status is 4xx if ( response . status >= 400 && response . status < 500 ) { const contentType = response . headers . get ( 'content-type' ) ; if ( contentType && contentType . includes ( 'application/json' ) ) { const body = await response . json ( ) ; throw new p_retry_1 . default . AbortError ( body . message ) ; } else { throw new p_retry_1 . default . AbortError ( response . statusText ) ; } } return response ; } return p_retry_1 . default ( fetchWrapper , { retries : RETRY_COUNT } ) ; }
Performs fetch with retries in case of HTTP errors
@param url request url
@param options request options
@returns Returns a Promise that resolves with the response object
Performs fetch with retries in case of HTTP errors