Skip to content

Commit

Permalink
[core-https] Fix API review comments (Azure#13943)
Browse files Browse the repository at this point in the history
- Fix typo in exponentialRetryPolicyName constant.
- Make sure concrete HttpsClient types stay hidden.
  • Loading branch information
xirzec authored Feb 24, 2021
1 parent 0db4909 commit 0a24c62
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
6 changes: 3 additions & 3 deletions sdk/core/core-https/review/core-https.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ export const decompressResponsePolicyName = "decompressResponsePolicy";
// @public
export function exponentialRetryPolicy(options?: ExponentialRetryPolicyOptions): PipelinePolicy;

// @public
export const exponentialRetryPolicyName = "exponentialRetryPolicy";

// @public
export interface ExponentialRetryPolicyOptions {
maxRetries?: number;
maxRetryDelayInMs?: number;
retryDelayInMs?: number;
}

// @public
export const expontentialRetryPolicyName = "exponentialRetryPolicy";

// @public
export type FormDataMap = {
[key: string]: FormDataValue | FormDataValue[];
Expand Down
10 changes: 9 additions & 1 deletion sdk/core/core-https/src/defaultHttpsClient.browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export { createXhrHttpsClient as createDefaultHttpsClient } from "./xhrHttpsClient";
import { HttpsClient } from "./interfaces";
import { createXhrHttpsClient } from "./xhrHttpsClient";

/**
* Create the correct HttpsClient for the current environment.
*/
export function createDefaultHttpsClient(): HttpsClient {
return createXhrHttpsClient();
}
10 changes: 9 additions & 1 deletion sdk/core/core-https/src/defaultHttpsClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

export { createNodeHttpsClient as createDefaultHttpsClient } from "./nodeHttpsClient";
import { HttpsClient } from "./interfaces";
import { createNodeHttpsClient } from "./nodeHttpsClient";

/**
* Create the correct HttpsClient for the current environment.
*/
export function createDefaultHttpsClient(): HttpsClient {
return createNodeHttpsClient();
}
2 changes: 1 addition & 1 deletion sdk/core/core-https/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export {
export {
exponentialRetryPolicy,
ExponentialRetryPolicyOptions,
expontentialRetryPolicyName
exponentialRetryPolicyName
} from "./policies/exponentialRetryPolicy";
export {
setClientRequestIdPolicy,
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-https/src/nodeHttpsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ function getBodyLength(body: RequestBodyType): number | null {

/**
* Create a new HttpsClient instance for the NodeJS environment.
* @internal
*/
export function createNodeHttpsClient(): HttpsClient {
return new NodeHttpsClient();
Expand Down
4 changes: 2 additions & 2 deletions sdk/core/core-https/src/policies/exponentialRetryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { RestError } from "../restError";
/**
* The programmatic identifier of the exponentialRetryPolicy.
*/
export const expontentialRetryPolicyName = "exponentialRetryPolicy";
export const exponentialRetryPolicyName = "exponentialRetryPolicy";

const DEFAULT_CLIENT_RETRY_COUNT = 10;
// intervals are in ms
Expand Down Expand Up @@ -152,7 +152,7 @@ export function exponentialRetryPolicy(
}

return {
name: expontentialRetryPolicyName,
name: exponentialRetryPolicyName,
async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {
const retryData = {
retryCount: 0,
Expand Down
1 change: 1 addition & 0 deletions sdk/core/core-https/src/xhrHttpsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ function rejectOnTerminalEvent(

/**
* Create a new HttpsClient instance for the browser environment.
* @internal
*/
export function createXhrHttpsClient(): HttpsClient {
return new XhrHttpsClient();
Expand Down

0 comments on commit 0a24c62

Please sign in to comment.