import { Logger } from '@n8n/backend-common'; import type { IHttpRequestOptions, IN8nHttpFullResponse, IN8nHttpResponse, IRequestOptions } from 'n8n-workflow'; import type http from 'node:http'; import type https from 'node:https'; import type { Readable } from 'node:stream'; import type { Dispatcher } from 'undici'; import { SsrfProtectionService } from '../ssrf'; import { HttpRequestClientOptions } from './client-options'; import { type LegacyRequestCallbacks } from './legacy-request'; import type { NodeAgentOptions, ProxyOption, SsrfOption } from './node-agents'; import { type CustomFetch, type RequestAuthorizer, type TransportTimeoutOptions } from './undici/transport'; export interface HttpTransportOptions { proxy?: ProxyOption; ssrf?: SsrfOption; timeouts?: TransportTimeoutOptions; authorize?: RequestAuthorizer; } export type TypedHttpFullResponse = Omit & { body: T; }; export interface HttpRequestClient { request(options: IHttpRequestOptions & { returnFullResponse: true; }): Promise>; request(options: IHttpRequestOptions & { returnFullResponse?: false; }): Promise; request(options: IHttpRequestOptions): Promise>; requestLegacy(options: IRequestOptions, callbacks?: LegacyRequestCallbacks): Promise; } export interface HttpTransport { asCustomFetch(): CustomFetch; getDispatcher(): Dispatcher; getNodeAgent(agentOptions?: NodeAgentOptions): { httpAgent: http.Agent; httpsAgent: https.Agent; }; } export declare class OutboundHttp { private readonly ssrfProtection; private readonly logger; constructor(ssrfProtection: SsrfProtectionService, logger: Logger); requests(options?: HttpRequestClientOptions): HttpRequestClient; transport(options?: HttpTransportOptions): HttpTransport; }