UNPKG

1.52 kBTypeScriptView Raw
1import { Destination, Protocol } from '../connectivity/scp-cf';
2import { HttpRequestConfig } from '../http-client';
3import { HttpAgentConfig, HttpsAgentConfig } from './agent-config';
4/**
5 * Returns the http or https-agent config depending on the destination URL.
6 * If the destination contains a proxy configuration, the agent will be a proxy-agent.
7 * If not it will be the default http-agent coming from node.
8 * @param destination - determining which kind of configuration is returned
9 * @returns The http or http-agent configuration.
10 */
11export declare function getAgentConfig(destination: Destination): HttpAgentConfig | HttpsAgentConfig;
12/**
13 * @deprecated Since v1.5.1. use getProtocolOrDefault instead
14 * Takes the destination URL and return everything before the `://`.
15 * @param destination - URL of this destination is parsed
16 * @returns The protocol either `undefined` if no `://` is found or anything before the delimiter.
17 */
18export declare function getUrlProtocol(destination: Destination): Protocol | undefined;
19/**
20 * Builds part of the request config containing the URL and if needed proxy agents or normal http agents.
21 * Considers the `no_proxy` environment variable together with the `targetUri`.
22 * @param targetUri - Used as baseURL in request config.
23 * @returns HttpRequestConfig containing baseUrl and http(s) agents.
24 */
25export declare function urlAndAgent(targetUri: string): Pick<HttpRequestConfig, 'baseURL' | 'httpAgent' | 'httpsAgent' | 'proxy'>;
26//# sourceMappingURL=http-agent.d.ts.map
\No newline at end of file