Skip to content

Commit 53d67d1

Browse files
committed
Check url parameter is provided
1 parent b837306 commit 53d67d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ class Service {
3939
* - Handles special cases for 'pal-' and 'checkout-' endpoints.
4040
* @param url - The original endpoint URL.
4141
* @returns The formatted endpoint URL.
42-
* @throws Error if liveEndpointUrlPrefix is missing for LIVE environment.
42+
* @throws Error if url is not provided or liveEndpointUrlPrefix is missing for LIVE environment.
4343
*/
4444
protected createBaseUrl(url: string): string {
4545
const config: Config = this.client.config;
4646

47+
if(!url) {
48+
throw new Error("Endpoint URL must be provided.");
49+
}
50+
4751
if (config.environment !== "LIVE") {
4852
return url.replace("-live", "-test");
4953
}

0 commit comments

Comments
 (0)