@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
26 lines • 1.52 kB
TypeScript
import { Destination, Protocol } from '../connectivity/scp-cf';
import { HttpRequestConfig } from '../http-client';
import { HttpAgentConfig, HttpsAgentConfig } from './agent-config';
/**
* Returns the http or https-agent config depending on the destination URL.
* If the destination contains a proxy configuration, the agent will be a proxy-agent.
* If not it will be the default http-agent coming from node.
* @param destination - determining which kind of configuration is returned
* @returns The http or http-agent configuration.
*/
export declare function getAgentConfig(destination: Destination): HttpAgentConfig | HttpsAgentConfig;
/**
* @deprecated Since v1.5.1. use getProtocolOrDefault instead
* Takes the destination URL and return everything before the `://`.
* @param destination - URL of this destination is parsed
* @returns The protocol either `undefined` if no `://` is found or anything before the delimiter.
*/
export declare function getUrlProtocol(destination: Destination): Protocol | undefined;
/**
* Builds part of the request config containing the URL and if needed proxy agents or normal http agents.
* Considers the `no_proxy` environment variable together with the `targetUri`.
* @param targetUri - Used as baseURL in request config.
* @returns HttpRequestConfig containing baseUrl and http(s) agents.
*/
export declare function urlAndAgent(targetUri: string): Pick<HttpRequestConfig, 'url' | 'httpAgent' | 'httpsAgent' | 'proxy'>;
//# sourceMappingURL=http-agent.d.ts.map