@@ -3,6 +3,7 @@ import { AsyncQueue } from '@sapphire/async-queue';
3
3
import type { RoutePlannerStatusResponse , LoadTrackResponse , LavalinkTrack , LavalinkSource } from 'lavalink-api-types' ;
4
4
import { LavalinkSourceEnum , LavalinkSearchIdentifierEnum , Routes } from 'lavalink-api-types' ;
5
5
import type { RequestInit } from 'undici' ;
6
+ import { join } from 'path' ;
6
7
7
8
export class REST {
8
9
public headers : { [ key : string ] : string } = { } ;
@@ -87,7 +88,7 @@ export class REST {
87
88
public async get < T > ( route : string , init ?: RequestInit | undefined ) : Promise < T > {
88
89
await this . queue . wait ( ) ;
89
90
try {
90
- return fetch ( new URL ( route , this . url ) , { headers : this . headers , ...init } , FetchResultTypes . JSON ) ;
91
+ return fetch ( new URL ( join ( this . url , route ) ) , { headers : this . headers , ...init } , FetchResultTypes . JSON ) ;
91
92
} finally {
92
93
this . queue . shift ( ) ;
93
94
}
@@ -96,7 +97,7 @@ export class REST {
96
97
public async post < T > ( route : string , init ?: RequestInit | undefined ) : Promise < T > {
97
98
await this . queue . wait ( ) ;
98
99
try {
99
- return fetch ( new URL ( route , this . url ) , { headers : this . headers , method : 'POST' , ...init } , FetchResultTypes . JSON ) ;
100
+ return fetch ( new URL ( join ( this . url , route ) ) , { headers : this . headers , method : 'POST' , ...init } , FetchResultTypes . JSON ) ;
100
101
} finally {
101
102
this . queue . shift ( ) ;
102
103
}
0 commit comments