19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
|
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",
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
}
|