當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript task.getHttpProxyConfiguration函數代碼示例

本文整理匯總了TypeScript中azure-pipelines-task-lib/task.getHttpProxyConfiguration函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript getHttpProxyConfiguration函數的具體用法?TypeScript getHttpProxyConfiguration怎麽用?TypeScript getHttpProxyConfiguration使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了getHttpProxyConfiguration函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

    constructor() {
        const serverUrl: string = tl.getVariable('System.TeamFoundationCollectionUri');
        const serverCreds: string = tl.getEndpointAuthorizationParameter('SYSTEMVSSCONNECTION', 'ACCESSTOKEN', false);
        const authHandler = getPersonalAccessTokenHandler(serverCreds);

        const proxy = tl.getHttpProxyConfiguration();
        const options = proxy ? { proxy, ignoreSslError: true } : undefined;

        this.serverConnection = new WebApi(serverUrl, authHandler, options);
    }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:10,代碼來源:securefiles-common.ts

示例2: getWebApiWithProxy

export function getWebApiWithProxy(serviceUri: string, accessToken?: string): vsts.WebApi {
    if (!accessToken) {
        accessToken = getSystemAccessToken();
    }

    const credentialHandler = vsts.getBasicHandler('vsts', accessToken);
    const options: IRequestOptions = {
        proxy: tl.getHttpProxyConfiguration(serviceUri)
    };
    return new vsts.WebApi(serviceUri, credentialHandler, options);
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:11,代碼來源:locationUtilities.ts

示例3: installNuGet

 public static async installNuGet(version: string) {
     try {
         const proxy: tl.ProxyConfiguration = tl.getHttpProxyConfiguration();
         if (proxy) {
             console.log(tl.loc("InstallingNuGetVersion", version));
             await nuGetGetter.getNuGet(version, false, true);
             NuGetInstaller.setProxy(proxy);
         }
     }
     catch (error) {
         throw tl.loc("FailureWhileInstallingNuGetVersion", version, error.message);
     }
 }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:13,代碼來源:nugetinstaller.ts

示例4: isEndpointInternal

    // make a request to the endpoint uri, and take a look at the response header to
    // determine whether this is our service, or an external service.
    private static async isEndpointInternal(endpointUri: string): Promise<boolean> {
        let requestOptions: IRequestOptions;
        try {
            const proxy = tl.getHttpProxyConfiguration();
            requestOptions = proxy ? { proxy } : {};
        } catch (error) {
            tl.debug('unable to determine proxy configuration: ' + error);
            requestOptions = {};
        }

        const headers: IHeaders = {};
        headers['X-TFS-FedAuthRedirect'] = 'Suppress';

        const endpointClient = new HttpClient(tl.getVariable('AZURE_HTTP_USER_AGENT'), null, requestOptions);
        try {
            const resp = await endpointClient.get(endpointUri, headers);
            return resp.message.rawHeaders !== null && resp.message.rawHeaders.some( t => t.toLowerCase().indexOf('x-tfs') >= 0 || t.toLowerCase().indexOf('x-vss') >= 0 );
        } catch (error) {
            tl.debug(error);
            return false;
        }
    }
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:24,代碼來源:npmregistry.ts

示例5: run

async function run() {
    try {
        //
        // Version is optional.  If supplied, install / use from the tool cache
        // If not supplied then task is still used to setup proxy, auth, etc...
        //
        const version = taskLib.getInput('version', false);
        if (version) {
            const checkLatest: boolean = taskLib.getBoolInput('checkLatest', false);

            // TODO: installer doesn't support proxy
            await installer.getNode(version, checkLatest);
        }

        const proxyCfg: taskLib.ProxyConfiguration = taskLib.getHttpProxyConfiguration();
        if (proxyCfg) {
            proxyutil.setCurlProxySettings(proxyCfg);
        }
    }
    catch (error) {
        taskLib.setResult(taskLib.TaskResult.Failed, error.message);
    }
}
開發者ID:Microsoft,項目名稱:vsts-tasks,代碼行數:23,代碼來源:usenode.ts


注:本文中的azure-pipelines-task-lib/task.getHttpProxyConfiguration函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。