Skip to content
Myr

legacy.ts

This file

Path

examples/burrow/packages/kit/src/legacy.ts

28 lines · 799 bytes · TypeScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 1–28why, one step back
1import { fetchTransport, isSuccess } from "./transport.ts";
2import type { Transport } from "./transport.ts";34// How many requests went out through `legacyFetch`, for the debug page.5let requestsSent = 0;67/** How many requests `legacyFetch` has sent since the process started. */8export const legacyRequestsSent = () => requestsSent;910/**11 * The first HTTP helper, from before `http.get`: it returns the body as12 * text and throws on any status that isn't a success. New code uses13 * `http.get`.14 */15export const legacyFetch = async (16 url: string,17 transport: Transport = fetchTransport18): Promise<string> => {19 requestsSent += 1;2021 const reply = await transport(url);2223 if (!isSuccess(reply.status)) {24 throw new Error(`GET ${url} answered ${reply.status}`);25 }2627 return reply.text;28};