Versions

  • v5

    3/30/2024
    Open: Version
    Changes from v4 to v5
    +0
    -1
    ⦚ 9 unchanged lines ⦚
    url = normalizeURL(url.toString());
    let headers = new Headers(options?.headers ?? {});
    headers.set("accept", "application/json");
    if (options?.bearer) {
    headers.set("authorization", `Bearer ${options.bearer}`);
    }
    ⦚ 8 unchanged lines ⦚
    ⦚ 9 unchanged lines ⦚
    url = normalizeURL(url.toString());
    let headers = new Headers(options?.headers ?? {});
    if (options?.bearer) {
    headers.set("authorization", `Bearer ${options.bearer}`);
    }
    ⦚ 8 unchanged lines ⦚
  • v4

    3/28/2024
    Open: Version
    Changes from v3 to v4
    +1
    -1
    ⦚ 7 unchanged lines ⦚
    },
    ) => {
    let headers = new Headers(options?.headers ?? {});
    headers.set("accept", "application/json");
    if (options?.bearer) {
    headers.set("authorization", `Bearer ${options.bearer}`);
    }
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString());
    let resp = await fetch(url, {
    redirect: "follow",
    ⦚ 5 unchanged lines ⦚
    ⦚ 7 unchanged lines ⦚
    },
    ) => {
    url = normalizeURL(url.toString());
    let headers = new Headers(options?.headers ?? {});
    headers.set("accept", "application/json");
    if (options?.bearer) {
    headers.set("authorization", `Bearer ${options.bearer}`);
    }
    let fetch = options?.fetch ?? globalThis.fetch;
    let resp = await fetch(url, {
    redirect: "follow",
    ⦚ 5 unchanged lines ⦚
  • v3

    3/28/2024
    Open: Version
    Changes from v2 to v3
    +1
    -1
    ⦚ 14 unchanged lines ⦚
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString());
    let resp = await fetch(url), {
    redirect: "follow",
    ...options,
    ⦚ 4 unchanged lines ⦚
    ⦚ 14 unchanged lines ⦚
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString());
    let resp = await fetch(url, {
    redirect: "follow",
    ...options,
    ⦚ 4 unchanged lines ⦚
  • v2

    3/28/2024
    Open: Version
    Changes from v1 to v2
    +1
    -1
    ⦚ 13 unchanged lines ⦚
    }
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString();
    let resp = await fetch(url), {
    redirect: "follow",
    ⦚ 5 unchanged lines ⦚
    ⦚ 13 unchanged lines ⦚
    }
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString());
    let resp = await fetch(url), {
    redirect: "follow",
    ⦚ 5 unchanged lines ⦚
  • v1

    3/28/2024
    Open: Version
    Changes from v0 to v1
    +18
    -4
    import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";

    export const fetchText = async (url: string, options?: any) => {
    let f = await fetch(normalizeURL(url), {
    redirect: "follow",
    ...(options || {}),
    });
    return f.text();
    };
    import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";

    export const fetchText = async (
    url: string | URL,
    options?: RequestInit & {
    bearer?: string;
    fetch?: typeof fetch;
    },
    ) => {
    let headers = new Headers(options?.headers ?? {});
    headers.set("accept", "application/json");
    if (options?.bearer) {
    headers.set("authorization", `Bearer ${options.bearer}`);
    }
    let fetch = options?.fetch ?? globalThis.fetch;
    url = normalizeURL(url.toString();
    let resp = await fetch(url), {
    redirect: "follow",
    ...options,
    headers,
    });
    return resp.text();
    };
  • v0

    3/28/2024
    Open: Version
    +9
    -0

    import { normalizeURL } from "https://esm.town/v/stevekrouse/normalizeURL";

    export const fetchText = async (url: string, options?: any) => {
    let f = await fetch(normalizeURL(url), {
    redirect: "follow",
    ...(options || {}),
    });
    return f.text();
    };
1
Next
Updated: March 30, 2024