| import { request } from "undici"; | |
| export async function fetchText(url: string, init?: { headers?: Record<string, string> }) { | |
| const { body } = await request(url, { | |
| method: "GET", | |
| headers: { | |
| "Accept": "text/html,application/xhtml+xml", | |
| ...(init?.headers ?? {}) | |
| }, | |
| maxRedirections: 5 | |
| }); | |
| return await body.text(); | |
| } | |