All files / src/common axios-retry.ts

60% Statements 3/5
100% Branches 0/0
0% Functions 0/2
60% Lines 3/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 173x 3x   3x                          
import axios from "axios";
import { retry } from "./retry";
 
export async function axiosGetWithRetries<T>(args: {
  url: string;
  retryLimit: number;
  retryDelayMilliseconds?: number;
  timeout?: number;
}): Promise<T> {
  return (await retry({
    fn: async () => await axios.get(args.url, { timeout: args.timeout }),
    fnName: `axios.get`,
    maxRetries: args.retryLimit,
    waitBetweenMs: args.retryDelayMilliseconds,
  })()) as T;
}