Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

787 B
Raw Blame
import { afterEach, describe, expect, it, vi } from "vitest";
import { getAuthHeaderName, getRequestBaseUrl } from "./runtime";

describe("runtime request config defaults", () => {
  afterEach(() => {
    vi.unstubAllEnvs();
  });

  it("resolves the default base URL from NEXT_PUBLIC_BASE_URL before a getter is registered", () => {
    vi.stubEnv("NEXT_PUBLIC_BASE_URL", "https://proxy.example.com/");
    expect(getRequestBaseUrl()).toBe("https://proxy.example.com");
  });

  it("defaults the base URL to same-origin when NEXT_PUBLIC_BASE_URL is unset", () => {
    vi.stubEnv("NEXT_PUBLIC_BASE_URL", "");
    expect(getRequestBaseUrl()).toBe("");
  });

  it("defaults the auth header name to Authorization", () => {
    expect(getAuthHeaderName()).toBe("Authorization");
  });
});