@microsoft/vscode-azext-azureutils
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -365,3 +365,7 @@ /*--------------------------------------------------------------------------------------------- | ||
*/ | ||
export declare function createGenericClient(context: IActionContext, clientInfo: AzExtGenericClientInfo | undefined): Promise<ServiceClient>; | ||
export declare function createGenericClient(context: IActionContext, clientInfo: AzExtGenericClientInfo | undefined, options?: IGenericClientOptions): Promise<ServiceClient>; | ||
export interface IGenericClientOptions { | ||
noRetryPolicy?: boolean; | ||
addStatusCodePolicy?: boolean; | ||
} | ||
@@ -368,0 +372,0 @@ export type AzExtRequestPrepareOptions = PipelineRequestOptions & { rejectUnauthorized?: boolean } |
@@ -69,3 +69,3 @@ "use strict"; | ||
} | ||
const client = yield createGenericClient(context, clientInfo, { noRetryPolicy: true }); | ||
const client = yield createGenericClient(context, clientInfo, { noRetryPolicy: true, addStatusCodePolicy: true }); | ||
return yield client.sendRequest(request); | ||
@@ -91,3 +91,3 @@ }); | ||
}); | ||
addAzExtPipeline(context, client.pipeline, endpoint, { retryOptions }); | ||
addAzExtPipeline(context, client.pipeline, endpoint, { retryOptions }, options === null || options === void 0 ? void 0 : options.addStatusCodePolicy); | ||
return client; | ||
@@ -97,3 +97,3 @@ }); | ||
exports.createGenericClient = createGenericClient; | ||
function addAzExtPipeline(context, pipeline, endpoint, options) { | ||
function addAzExtPipeline(context, pipeline, endpoint, options, addStatusCodePolicy) { | ||
// ServiceClient has default pipeline policies that the core-client SDKs require. Rather than building an entirely custom pipeline, | ||
@@ -120,3 +120,5 @@ // it's easier to just remove the default policies and add ours as-needed | ||
pipeline.addPolicy(new RemoveBOMPolicy(), { phase: 'Deserialize', beforePolicies: [MissingContentTypePolicy.Name] }); | ||
pipeline.addPolicy(new StatusCodePolicy() /*intentionally not in a phase*/); | ||
if (addStatusCodePolicy) { | ||
pipeline.addPolicy(new StatusCodePolicy() /*intentionally not in a phase*/); | ||
} | ||
return pipeline; | ||
@@ -123,0 +125,0 @@ } |
{ | ||
"name": "@microsoft/vscode-azext-azureutils", | ||
"author": "Microsoft Corporation", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Common Azure utils for developing Azure extensions for VS Code", | ||
@@ -6,0 +6,0 @@ "tags": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127100
2042