2026-03-16 01:05:18 -07:00
|
|
|
/** Extract a string URL from the common request-like inputs accepted by fetch helpers. */
|
2026-03-07 10:40:49 +00:00
|
|
|
export function resolveRequestUrl(input: RequestInfo | URL): string {
|
|
|
|
|
if (typeof input === "string") {
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
if (input instanceof URL) {
|
|
|
|
|
return input.toString();
|
|
|
|
|
}
|
|
|
|
|
if (typeof input === "object" && input && "url" in input && typeof input.url === "string") {
|
|
|
|
|
return input.url;
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|