本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例5: WebApi
.then(url => {
const options: IRequestOptions = {
proxy: tl.getHttpProxyConfiguration(url)
};
return new WebApi(url, new BearerHandlerForPresignedUrls(accessToken), options);
})