All files / src/common fetch-with-fallback.ts

50% Statements 3/6
100% Branches 0/0
0% Functions 0/2
50% Lines 2/4

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 143x             3x            
import axios, { AxiosRequestConfig, AxiosResponse } from "axios";
 
export type AxiosGetRequest = {
  urls: string[];
  axiosConfig?: AxiosRequestConfig;
};
 
export const fetchWithFallbacks = <T>(
  args: AxiosGetRequest
): Promise<AxiosResponse<T>> => {
  const requests = args.urls.map((url) => axios.get<T>(url, args.axiosConfig));
  return Promise.any(requests);
};