diff --git a/src/exceptions/FortniteAPIError.ts b/src/exceptions/FortniteAPIError.ts index bf5849a..e11f2cb 100644 --- a/src/exceptions/FortniteAPIError.ts +++ b/src/exceptions/FortniteAPIError.ts @@ -9,7 +9,7 @@ class FortniteAPIError extends Error { * The HTTP method */ public method: string; - + /** * The URL of the requested API endpoint */ @@ -35,7 +35,7 @@ class FortniteAPIError extends Error { this.name = 'FortniteAPIError'; this.message = error.error; - this.method = request.method!.toUpperCase(); + this.method = request.method?.toUpperCase() ?? 'GET' this.url = request.url!; this.httpStatus = status; this.requestParams = request.params; diff --git a/src/http/HTTP.ts b/src/http/HTTP.ts index e61dd65..b30bcc7 100644 --- a/src/http/HTTP.ts +++ b/src/http/HTTP.ts @@ -43,7 +43,7 @@ class HTTP { }; try { - const response = await this.axios(config); + const response = await instance(config); return response.data; } catch (e) { @@ -56,7 +56,7 @@ class HTTP { } } - throw new FortniteAPIError(e.response.data, config, e.response.status); + throw new FortniteAPIError(e.response.data, e.config ?? config, e.response.status); } throw e;