import { httpFetch, httpFetchParseIncomingMessage } from '../../server/src/fetch/http-fetch'; import type { IncomingMessage } from 'http'; import type { Readable } from 'stream'; import { createAuthFetch } from '../../packages/auth-fetch/src/auth-fetch'; export type { HttpFetchOptions, HttpFetchResponseType } from '../../server/src/fetch/http-fetch'; export type { AuthFetchCredentialState, AuthFetchOptions } from '../../packages/auth-fetch/src/auth-fetch'; export const authHttpFetch = createAuthFetch(httpFetch, httpFetchParseIncomingMessage); function ensureType(v: T) { } async function test() { const a = await authHttpFetch({ credential: undefined, url: 'http://example.com', }); ensureType(a.body); const b = await authHttpFetch({ credential: undefined, url: 'http://example.com', responseType: 'json', }); ensureType(b.body); const c = await authHttpFetch({ credential: undefined, url: 'http://example.com', responseType: 'readable', }); ensureType(c.body); const d = await authHttpFetch({ credential: undefined, url: 'http://example.com', responseType: 'buffer', }); ensureType(d.body); const e = await authHttpFetch({ credential: undefined, url: 'http://example.com', responseType: 'text', }); ensureType(e.body); }