当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript task.getHttpProxyConfiguration函数代码示例

本文整理汇总了TypeScript中vsts-task-lib/task.getHttpProxyConfiguration函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getHttpProxyConfiguration函数的具体用法?TypeScript getHttpProxyConfiguration怎么用?TypeScript getHttpProxyConfiguration使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getHttpProxyConfiguration函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: getWebApi

export function getWebApi(serviceUri: string, accessToken: string): vsts.WebApi{
    const credentialHandler = vsts.getBasicHandler("vsts", accessToken);
    const options: IRequestOptions = {
        proxy: tl.getHttpProxyConfiguration(serviceUri),
    };
    return new vsts.WebApi(serviceUri, credentialHandler, options);
}
开发者ID:shubham90,项目名称:vsts-tasks,代码行数:7,代码来源:utilities.ts

示例2: constructor

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

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

        this.serverConnection = new vsts.WebApi(serverUrl, authHandler, options);
    }
开发者ID:grawcho,项目名称:vso-agent-tasks,代码行数:10,代码来源:securefiles-common.ts

示例3: 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:grawcho,项目名称:vso-agent-tasks,代码行数:11,代码来源:locationUtilities.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:shubham90,项目名称:vsts-tasks,代码行数:24,代码来源:npmregistry.ts

示例5: WebApi

 .then(url => {
     const options: IRequestOptions = {
         proxy: tl.getHttpProxyConfiguration(url)
     };
     return new WebApi(url, new BearerHandlerForPresignedUrls(accessToken), options);
 })
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:6,代码来源:connections.ts


注:本文中的vsts-task-lib/task.getHttpProxyConfiguration函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。