Skip to content

Commit cbaa410

Browse files
authored
[Tables] Expose client option allowInsecureConnection (Azure#15938)
In order for Tables to connect to Azurite and Storage emulator, the client needs to accept `allowInsecureConnection`. Also when using the emulator connection string shortcut, setting it by default.
1 parent d3c3f90 commit cbaa410

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

sdk/core/core-client/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.2.0 (UNRELEASED)
4+
5+
### Features Added
6+
7+
- Moved `allowInsecureConnection` from `ServiceClientOptions` to `CommonClientOptions` [issue 15938](https://github.com/azure/azure-sdk-for-js/issues/15938)
8+
39
## 1.1.3 (2021-06-17)
410

511
### Key Bugs Fixed

sdk/core/core-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azure/core-client",
3-
"version": "1.1.3",
3+
"version": "1.2.0",
44
"description": "Core library for interfacing with AutoRest generated code",
55
"sdk-type": "client",
66
"main": "dist/index.js",

sdk/core/core-client/review/core-client.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export interface BaseMapper {
3737

3838
// @public
3939
export interface CommonClientOptions extends PipelineOptions {
40+
allowInsecureConnection?: boolean;
4041
httpClient?: HttpClient;
4142
}
4243

@@ -351,7 +352,6 @@ export class ServiceClient {
351352

352353
// @public
353354
export interface ServiceClientOptions extends CommonClientOptions {
354-
allowInsecureConnection?: boolean;
355355
baseUri?: string;
356356
credential?: TokenCredential;
357357
credentialScopes?: string | string[];

sdk/core/core-client/src/interfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,4 +554,8 @@ export interface CommonClientOptions extends PipelineOptions {
554554
* The HttpClient that will be used to send HTTP requests.
555555
*/
556556
httpClient?: HttpClient;
557+
/**
558+
* Set to true if the request is sent over HTTP instead of HTTPS
559+
*/
560+
allowInsecureConnection?: boolean;
557561
}

sdk/core/core-client/src/serviceClient.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ export interface ServiceClientOptions extends CommonClientOptions {
4949
* A customized pipeline to use, otherwise a default one will be created.
5050
*/
5151
pipeline?: Pipeline;
52-
/**
53-
* Set to true if the request is sent over HTTP instead of HTTPS
54-
*/
55-
allowInsecureConnection?: boolean;
5652
}
5753

5854
/**

sdk/tables/data-tables/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Thank you to our developer community members who helped to make the Azure Tables
1717
- Fix [#15664](https://github.com/Azure/azure-sdk-for-js/issues/15701), adding check to make sure we always have only one forward slash (`/`) added to the end of the URL [#15698](https://github.com/Azure/azure-sdk-for-js/pull/15698) (A community contribution, courtesy of _[eestein](https://github.com/eestein))_
1818
- Fix [#15701](https://github.com/Azure/azure-sdk-for-js/issues/15701) by improving error handling and reporting on `submitTransaction`. [#15852](https://github.com/Azure/azure-sdk-for-js/pull/15852)
1919
- Fix [#15921](https://github.com/Azure/azure-sdk-for-js/issues/15921) incorrect `url` import and missing browser mapping for `computeHMACSHA256` [#15944](https://github.com/Azure/azure-sdk-for-js/pull/15944)
20+
- Fix [#15854](https://github.com/Azure/autorest.typescript/issues/892) by setting `allowInsecureConnection` to true when using the development connection string.
2021

2122
## 12.0.0 (2021-06-09)
2223

sdk/tables/data-tables/src/utils/connectionString.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ const DevelopmentConnectionString =
2121
*/
2222
export function getClientParamsFromConnectionString(
2323
connectionString: string,
24-
options?: TableServiceClientOptions
24+
options: TableServiceClientOptions = {}
2525
): ClientParamsFromConnectionString {
2626
if (connectionString.toLowerCase().indexOf("usedevelopmentstorage=true") !== -1) {
2727
connectionString = DevelopmentConnectionString;
28+
options.allowInsecureConnection = true;
2829
}
2930
const extractedCreds = extractConnectionStringParts(connectionString);
3031
if (extractedCreds.kind === "AccountConnString") {

0 commit comments

Comments
 (0)