Skip to main content
This function has multiple overloads
Converts any URL source to an absolute, properly encoded URL.
export declare function resolveUrl(input: {
  url: string;
  baseUrl: string;
}): Promise<string>;
Combines a relative URL with a base URL string. Use when you have an explicit base URL string to resolve relative paths against.

Examples

import { resolveUrl } from "@intuned/browser";
import { BrowserContext, Page } from "playwright";

interface Params {}

export default async function handler(
  params: Params,
  page: Page,
  context: BrowserContext
) {
  // Resolve from base URL string
  const absoluteUrl = await resolveUrl({
    url: "/lists/table",
    baseUrl: "https://sandbox.intuned.dev",
  });
  // Returns: "https://sandbox.intuned.dev/lists/table"
  console.log(absoluteUrl);
  return absoluteUrl;
}

Arguments

input
Object
required
Configuration object with different properties based on the overload

Returns: Promise<string>

Promise that resolves to the absolute, properly encoded URL string