Javascript-Library/src/common/WebRequest.ts

19 lines
431 B
TypeScript
Raw Normal View History

2024-04-14 21:11:46 +01:00
import axios, { AxiosResponse } from "axios";
export default class WebRequest {
/**
* Gets a response from the given URL.
*
* @param url the url
* @returns the response
*/
public static get(url: string): Promise<AxiosResponse<any, any>> {
return axios.get(url, {
validateStatus: () => true, // Don't throw errors
headers: {
"User-Agent": "McUtils-JS-Library/1.0",
},
});
}
}