initital commit
This commit is contained in:
18
src/common/WebRequest.ts
Normal file
18
src/common/WebRequest.ts
Normal file
@ -0,0 +1,18 @@
|
||||
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",
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user