import type { RawHeaders } from './StreamingResponse.js'; /** * The most redirect hops one streaming request follows. When a chain exceeds the cap, the last * redirect response goes to the caller as an ordinary non-200 response. The caller's error * handling decides whether to retry. */ export declare const MAX_STREAMING_REDIRECT_HOPS = 5; /** * The response shape the redirect loop inspects. A Node `IncomingMessage` satisfies it. */ export interface RedirectResponseSource { statusCode?: number; headers: RawHeaders; /** * Destroys the stream, so a followed redirect response releases its connection at once. A * source without it leaves the skipped body to the socket teardown. */ destroy?(): unknown; } /** * Issues a streaming request and follows up to {@link MAX_STREAMING_REDIRECT_HOPS} hops of * `301` and `307` redirects. Each hop calls `doRequest` again with the target URL, so the * request carries the same method, body, and headers to each target, the `Authorization` * header included. A `302` and every other status return to the caller unfollowed. * * The loop holds no state across calls. A reconnect starts from the original URL again and * re-follows the chain. * * @param url The URL of the initial request. * @param doRequest Issues one request and resolves with its response. The caller builds the * options inside it from the given URL, so each hop gets options for its own target. */ export declare function followStreamingRedirects(url: string, doRequest: (requestUrl: string) => Promise): Promise; //# sourceMappingURL=followRedirects.d.ts.map