Skip to content

Commit abf912f

Browse files
authored
fix: base url not undefined (#7)
1 parent 447a861 commit abf912f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

lib/url.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ import { getEnvOrThrow } from "./runtime.ts";
22

33
export function buildUrl(
44
path: string,
5-
baseUrl: string | undefined = getBaseUrl(),
5+
baseUrl: string = getBaseUrl(),
66
): string {
7-
if (!baseUrl) {
8-
return path.startsWith("/") ? path : `/${path}`;
9-
}
107
const normalizedBaseUrl = baseUrl.replace(/\/*$/, "");
118
const normalizedPath = path.replace(/^\/*|\/*$/g, "");
129
return `${normalizedBaseUrl}/${normalizedPath}`;
@@ -20,7 +17,7 @@ export function joinPath(...paths: string[]): string {
2017
return `/${normalizedPaths}`;
2118
}
2219

23-
export function getBaseUrl(): string | undefined {
20+
export function getBaseUrl(): string {
2421
const host = getEnvOrThrow("JET_BREEZE_HOST");
2522
const pathPrefix = getEnvOrThrow("JET_BREEZE_PATH_PREFIX");
2623

0 commit comments

Comments
 (0)