@sap-cloud-sdk/connectivity
Version:
SAP Cloud SDK for JavaScript connectivity
39 lines (38 loc) • 1.41 kB
TypeScript
import http from 'http';
import type { BasicProxyConfiguration, HttpDestination } from '../scp-cf';
import type { HttpAgentConfig, HttpsAgentConfig } from './agent-config';
/**
* Returns a promise of 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 A promise of the HTTP or HTTPS agent configuration.
*/
export declare function getAgentConfig(destination: HttpDestination): Promise<HttpAgentConfig | HttpsAgentConfig>;
/**
* Options used for establishing mTLS connections.
* @internal
*/
export interface MtlsOptions {
/**
* @internal
*/
cert: string;
/**
* @internal
*/
key: string;
}
/**
* 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`.
* @internal
* @param targetUri - Used as baseURL in request config.
* @returns HttpRequestConfig containing baseUrl and http(s) agents.
*/
export declare function urlAndAgent(targetUri: string): Promise<{
baseURL: string;
proxy?: BasicProxyConfiguration | false;
httpAgent?: http.Agent;
httpsAgent?: http.Agent;
}>;