diff --git a/src/Structures/REST.ts b/src/Structures/REST.ts index f544dc8..ec0d1e4 100644 --- a/src/Structures/REST.ts +++ b/src/Structures/REST.ts @@ -3,6 +3,7 @@ import { AsyncQueue } from '@sapphire/async-queue'; import type { RoutePlannerStatusResponse, LoadTrackResponse, LavalinkTrack, LavalinkSource } from 'lavalink-api-types'; import { LavalinkSourceEnum, LavalinkSearchIdentifierEnum, Routes } from 'lavalink-api-types'; import type { RequestInit } from 'undici'; +import { join } from 'path'; export class REST { public headers: { [key: string]: string } = {}; @@ -87,7 +88,7 @@ export class REST { public async get(route: string, init?: RequestInit | undefined): Promise { await this.queue.wait(); try { - return fetch(new URL(route, this.url), { headers: this.headers, ...init }, FetchResultTypes.JSON); + return fetch(new URL(join(this.url, route)), { headers: this.headers, ...init }, FetchResultTypes.JSON); } finally { this.queue.shift(); } @@ -96,7 +97,7 @@ export class REST { public async post(route: string, init?: RequestInit | undefined): Promise { await this.queue.wait(); try { - return fetch(new URL(route, this.url), { headers: this.headers, method: 'POST', ...init }, FetchResultTypes.JSON); + return fetch(new URL(join(this.url, route)), { headers: this.headers, method: 'POST', ...init }, FetchResultTypes.JSON); } finally { this.queue.shift(); }