From 6e3044d3e5bdac7a15a23e62a11a9ef26356c77c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:15:20 +0000 Subject: [PATCH 1/2] Bump @azure/storage-blob from 12.16.0 to 12.26.0 Bumps [@azure/storage-blob](https://github.com/Azure/azure-sdk-for-js) from 12.16.0 to 12.26.0. - [Release notes](https://github.com/Azure/azure-sdk-for-js/releases) - [Changelog](https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/Changelog-for-next-generation.md) - [Commits](https://github.com/Azure/azure-sdk-for-js/compare/@azure/storage-blob_12.16.0...@azure/storage-blob_12.26.0) --- updated-dependencies: - dependency-name: "@azure/storage-blob" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 296 +++++++++++++++++++++++++--------------------- 1 file changed, 163 insertions(+), 133 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3c74c263..f3bc5b59b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -129,20 +129,42 @@ } }, "node_modules/@azure/core-client": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.5.0.tgz", - "integrity": "sha512-YNk8i9LT6YcFdFO+RRU0E4Ef+A8Y5lhXo6lz61rwbG8Uo7kSqh0YqK04OexiilM43xd6n3Y9yBhLnb1NFNI9dA==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.2.tgz", + "integrity": "sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==", "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-asynciterator-polyfill": "^1.0.0", - "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.5.0", - "@azure/core-tracing": "1.0.0-preview.13", + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.4.0", + "@azure/core-rest-pipeline": "^1.9.1", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.6.1", "@azure/logger": "^1.0.0", - "tslib": "^2.2.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=12.0.0" + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-client/node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-client/node_modules/@azure/core-tracing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", + "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" } }, "node_modules/@azure/core-http": { @@ -170,6 +192,32 @@ "node": ">=12.0.0" } }, + "node_modules/@azure/core-http-compat": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.1.2.tgz", + "integrity": "sha512-5MnV1yqzZwgNLLjlizsU3QqOeQChkIXw781Fwh1xdAqJR5AA32IUaq6xv1BICJvfbHoa+JYcaij2HFkhLbNTJQ==", + "dev": true, + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-client": "^1.3.0", + "@azure/core-rest-pipeline": "^1.3.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-http-compat/node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "dev": true, + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@azure/core-http/node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -317,16 +365,16 @@ } }, "node_modules/@azure/core-xml": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.2.0.tgz", - "integrity": "sha512-oWWQUWfllD3RO8Ixnsw5RjAUWPitjRI+LXSM0KFmgkSjl0R6RTQzXU2SEMsgAENkD5nzyI4yPpTRJcN2svM6ug==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.4.4.tgz", + "integrity": "sha512-J4FYAqakGXcbfeZjwjMzjNcpcH4E+JtEBv+xcV1yL0Ydn/6wbQfeFKTCHh9wttAi0lmajHw7yBbHPRG+YHckZQ==", "dev": true, "dependencies": { - "fast-xml-parser": "^4.0.1", - "tslib": "^2.2.0" + "fast-xml-parser": "^4.4.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=12.0.0" + "node": ">=18.0.0" } }, "node_modules/@azure/data-tables": { @@ -535,83 +583,51 @@ } }, "node_modules/@azure/storage-blob": { - "version": "12.16.0", - "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.16.0.tgz", - "integrity": "sha512-jz33rUSUGUB65FgYrTRgRDjG6hdPHwfvHe+g/UrwVG8MsyLqSxg9TaW7Yuhjxu1v1OZ5xam2NU6+IpCN0xJO8Q==", + "version": "12.26.0", + "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.26.0.tgz", + "integrity": "sha512-SriLPKezypIsiZ+TtlFfE46uuBIap2HeaQVS78e1P7rz5OSbq0rsd52WE1mC5f7vAeLiXqv7I7oRhL3WFZEw3Q==", "dev": true, "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^3.0.0", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.4.0", + "@azure/core-client": "^1.6.2", + "@azure/core-http-compat": "^2.0.0", "@azure/core-lro": "^2.2.0", "@azure/core-paging": "^1.1.1", - "@azure/core-tracing": "1.0.0-preview.13", + "@azure/core-rest-pipeline": "^1.10.1", + "@azure/core-tracing": "^1.1.2", + "@azure/core-util": "^1.6.1", + "@azure/core-xml": "^1.4.3", "@azure/logger": "^1.0.0", "events": "^3.0.0", "tslib": "^2.2.0" }, "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@azure/storage-blob/node_modules/@azure/core-http": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-3.0.0.tgz", - "integrity": "sha512-BxI2SlGFPPz6J1XyZNIVUf0QZLBKFX+ViFjKOkzqD18J1zOINIQ8JSBKKr+i+v8+MB6LacL6Nn/sP/TE13+s2Q==", - "dev": true, - "dependencies": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.3.0", - "@azure/core-tracing": "1.0.0-preview.13", - "@azure/core-util": "^1.1.1", - "@azure/logger": "^1.0.0", - "@types/node-fetch": "^2.5.0", - "@types/tunnel": "^0.0.3", - "form-data": "^4.0.0", - "node-fetch": "^2.6.7", - "process": "^0.11.10", - "tslib": "^2.2.0", - "tunnel": "^0.0.6", - "uuid": "^8.3.0", - "xml2js": "^0.4.19" - }, - "engines": { - "node": ">=14.0.0" + "node": ">=18.0.0" } }, - "node_modules/@azure/storage-blob/node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "node_modules/@azure/storage-blob/node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", "dev": true, "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "tslib": "^2.6.2" }, "engines": { - "node": ">= 6" - } - }, - "node_modules/@azure/storage-blob/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true, - "bin": { - "uuid": "dist/bin/uuid" + "node": ">=18.0.0" } }, - "node_modules/@azure/storage-blob/node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "node_modules/@azure/storage-blob/node_modules/@azure/core-tracing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", + "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", "dev": true, "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=4.0.0" + "node": ">=18.0.0" } }, "node_modules/@azure/storage-queue": { @@ -10341,17 +10357,35 @@ } }, "@azure/core-client": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.5.0.tgz", - "integrity": "sha512-YNk8i9LT6YcFdFO+RRU0E4Ef+A8Y5lhXo6lz61rwbG8Uo7kSqh0YqK04OexiilM43xd6n3Y9yBhLnb1NFNI9dA==", + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.2.tgz", + "integrity": "sha512-kRdry/rav3fUKHl/aDLd/pDLcB+4pOFwPPTVEExuMyaI5r+JBbMWqRbCY1pn5BniDaU3lRxO9eaQ1AmSMehl/w==", "requires": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-asynciterator-polyfill": "^1.0.0", - "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.5.0", - "@azure/core-tracing": "1.0.0-preview.13", + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.4.0", + "@azure/core-rest-pipeline": "^1.9.1", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.6.1", "@azure/logger": "^1.0.0", - "tslib": "^2.2.0" + "tslib": "^2.6.2" + }, + "dependencies": { + "@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "requires": { + "tslib": "^2.6.2" + } + }, + "@azure/core-tracing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", + "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", + "requires": { + "tslib": "^2.6.2" + } + } } }, "@azure/core-http": { @@ -10412,6 +10446,28 @@ } } }, + "@azure/core-http-compat": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.1.2.tgz", + "integrity": "sha512-5MnV1yqzZwgNLLjlizsU3QqOeQChkIXw781Fwh1xdAqJR5AA32IUaq6xv1BICJvfbHoa+JYcaij2HFkhLbNTJQ==", + "dev": true, + "requires": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-client": "^1.3.0", + "@azure/core-rest-pipeline": "^1.3.0" + }, + "dependencies": { + "@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "dev": true, + "requires": { + "tslib": "^2.6.2" + } + } + } + }, "@azure/core-lro": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/@azure/core-lro/-/core-lro-2.2.4.tgz", @@ -10496,13 +10552,13 @@ } }, "@azure/core-xml": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.2.0.tgz", - "integrity": "sha512-oWWQUWfllD3RO8Ixnsw5RjAUWPitjRI+LXSM0KFmgkSjl0R6RTQzXU2SEMsgAENkD5nzyI4yPpTRJcN2svM6ug==", + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.4.4.tgz", + "integrity": "sha512-J4FYAqakGXcbfeZjwjMzjNcpcH4E+JtEBv+xcV1yL0Ydn/6wbQfeFKTCHh9wttAi0lmajHw7yBbHPRG+YHckZQ==", "dev": true, "requires": { - "fast-xml-parser": "^4.0.1", - "tslib": "^2.2.0" + "fast-xml-parser": "^4.4.1", + "tslib": "^2.6.2" } }, "@azure/data-tables": { @@ -10688,68 +10744,42 @@ } }, "@azure/storage-blob": { - "version": "12.16.0", - "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.16.0.tgz", - "integrity": "sha512-jz33rUSUGUB65FgYrTRgRDjG6hdPHwfvHe+g/UrwVG8MsyLqSxg9TaW7Yuhjxu1v1OZ5xam2NU6+IpCN0xJO8Q==", + "version": "12.26.0", + "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.26.0.tgz", + "integrity": "sha512-SriLPKezypIsiZ+TtlFfE46uuBIap2HeaQVS78e1P7rz5OSbq0rsd52WE1mC5f7vAeLiXqv7I7oRhL3WFZEw3Q==", "dev": true, "requires": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-http": "^3.0.0", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.4.0", + "@azure/core-client": "^1.6.2", + "@azure/core-http-compat": "^2.0.0", "@azure/core-lro": "^2.2.0", "@azure/core-paging": "^1.1.1", - "@azure/core-tracing": "1.0.0-preview.13", + "@azure/core-rest-pipeline": "^1.10.1", + "@azure/core-tracing": "^1.1.2", + "@azure/core-util": "^1.6.1", + "@azure/core-xml": "^1.4.3", "@azure/logger": "^1.0.0", "events": "^3.0.0", "tslib": "^2.2.0" }, "dependencies": { - "@azure/core-http": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-3.0.0.tgz", - "integrity": "sha512-BxI2SlGFPPz6J1XyZNIVUf0QZLBKFX+ViFjKOkzqD18J1zOINIQ8JSBKKr+i+v8+MB6LacL6Nn/sP/TE13+s2Q==", - "dev": true, - "requires": { - "@azure/abort-controller": "^1.0.0", - "@azure/core-auth": "^1.3.0", - "@azure/core-tracing": "1.0.0-preview.13", - "@azure/core-util": "^1.1.1", - "@azure/logger": "^1.0.0", - "@types/node-fetch": "^2.5.0", - "@types/tunnel": "^0.0.3", - "form-data": "^4.0.0", - "node-fetch": "^2.6.7", - "process": "^0.11.10", - "tslib": "^2.2.0", - "tunnel": "^0.0.6", - "uuid": "^8.3.0", - "xml2js": "^0.4.19" - } - }, - "form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", "dev": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "tslib": "^2.6.2" } }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true - }, - "xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "@azure/core-tracing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", + "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", "dev": true, "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" + "tslib": "^2.6.2" } } } From b1d0a39afbbb2ffcec3af6fa1631b5a389cd5f6b Mon Sep 17 00:00:00 2001 From: Emma Zhu Date: Mon, 16 Dec 2024 15:00:30 +0800 Subject: [PATCH 2/2] Fix test failures --- tests/blob/apis/blobbatch.test.ts | 20 +--- tests/blob/apis/service.test.ts | 8 +- tests/blob/blobCorsRequest.test.ts | 43 ++++---- tests/blob/oauth.test.ts | 8 +- tests/blob/sas.test.ts | 159 ++++++++--------------------- tests/testutils.ts | 14 ++- 6 files changed, 85 insertions(+), 167 deletions(-) diff --git a/tests/blob/apis/blobbatch.test.ts b/tests/blob/apis/blobbatch.test.ts index 594dcb5a6..109255c04 100644 --- a/tests/blob/apis/blobbatch.test.ts +++ b/tests/blob/apis/blobbatch.test.ts @@ -73,9 +73,7 @@ describe("Blob batch API", () => { it("SubmitBatch batch deleting @loki @sql", async () => { const blobBatchClient = serviceClient.getBlobBatchClient(); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; // Submit batch request and verify response. const urls = blobClients.map((b) => b.url); @@ -107,9 +105,7 @@ describe("Blob batch API", () => { it("SubmitBatch within container scope - batch set tier @loki @sql", async () => { const blobBatchClient = containerClient.getBlobBatchClient(); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; // Submit batch request and verify response. const urls = blobClients.map((b) => b.url); @@ -136,9 +132,7 @@ describe("Blob batch API", () => { it("SubmitBatch batch set tier @loki @sql", async () => { const blobBatchClient = serviceClient.getBlobBatchClient(); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; // Submit batch request and verify response. const urls = blobClients.map((b) => b.url); @@ -173,9 +167,7 @@ describe("Blob batch API", () => { const blobclientsNew: BlobClient[] = []; blobclientsNew.push(blockBlobClientNew); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; // Submit batch request and verify response. const urls = blobclientsNew.map((b) => b.url); @@ -332,9 +324,7 @@ describe("Blob batch API", () => { it("SubmitBatch batch with different operations @loki @sql", async () => { const blobBatchClient = serviceClient.getBlobBatchClient(); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; // Submit batch request and verify response. const urls = blobClients.map((b) => b.url); diff --git a/tests/blob/apis/service.test.ts b/tests/blob/apis/service.test.ts index cf9e94850..16c04e243 100644 --- a/tests/blob/apis/service.test.ts +++ b/tests/blob/apis/service.test.ts @@ -66,7 +66,7 @@ describe("ServiceAPIs", () => { await serviceClient.getUserDelegationKey(startTime, expiryTime); assert.fail("Should fail to invoke getUserDelegationKey with account key credentials") } catch (error) { - assert.strictEqual((error as any).details.AuthenticationErrorDetail, "Only authentication scheme Bearer is supported"); + assert.strictEqual((error as any).details.authenticationErrorDetail, "Only authentication scheme Bearer is supported"); } }); @@ -77,9 +77,7 @@ describe("ServiceAPIs", () => { const sasTokenExpiry = new Date(); sasTokenExpiry.setDate(sasTokenExpiry.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sharedKeyCredential = factories[factories.length - 1]; + const sharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; const sas = generateAccountSASQueryParameters( { @@ -107,7 +105,7 @@ describe("ServiceAPIs", () => { await serviceClientWithSAS.getUserDelegationKey(skStart, skExpiry); assert.fail("Should fail to invoke getUserDelegationKey with SAS token credentials") } catch (error) { - assert.strictEqual((error as any).details.AuthenticationErrorDetail, "Only authentication scheme Bearer is supported"); + assert.strictEqual((error as any).details.authenticationErrorDetail, "Only authentication scheme Bearer is supported"); } }); diff --git a/tests/blob/blobCorsRequest.test.ts b/tests/blob/blobCorsRequest.test.ts index cd54d667f..c2a394337 100644 --- a/tests/blob/blobCorsRequest.test.ts +++ b/tests/blob/blobCorsRequest.test.ts @@ -11,6 +11,7 @@ import BlobTestServerFactory from "../BlobTestServerFactory"; import { EMULATOR_ACCOUNT_KEY, EMULATOR_ACCOUNT_NAME, + getResponseHeader, sleep } from "../testutils"; import OPTIONSRequestPolicyFactory from "./RequestPolicy/OPTIONSRequestPolicyFactory"; @@ -629,9 +630,9 @@ describe("Blob Cors requests test", () => { const res: any = await serviceClientWithOrigin.getProperties(); - assert.ok(res["access-control-allow-origin"] === undefined); - assert.ok(res["access-control-expose-headers"] === undefined); - assert.ok(res.vary === undefined); + assert.ok(getResponseHeader(res, "access-control-allow-origin") === undefined); + assert.ok(getResponseHeader(res, "access-control-expose-headers") === undefined); + assert.ok(getResponseHeader(res, "vary") === undefined); }); it("Service with mismatching cors rules should response header Vary @loki @sql", async () => { @@ -667,10 +668,10 @@ describe("Blob Cors requests test", () => { const serviceClientWithOrigin = new BlobServiceClient(baseURL, pipeline); let res: any = await serviceClientWithOrigin.getProperties(); - assert.ok(res.vary !== undefined); + assert.ok(getResponseHeader(res, "vary") !== undefined); res = await serviceClient.getProperties(); - assert.ok(res.vary === undefined); + assert.ok(getResponseHeader(res, "vary") === undefined); }); it("Request Match rule exists that allows all origins (*) @loki @sql", async () => { @@ -706,14 +707,14 @@ describe("Blob Cors requests test", () => { const serviceClientWithOrigin = new BlobServiceClient(baseURL, pipeline); let res: any = await serviceClientWithOrigin.getProperties(); - assert.ok(res["access-control-allow-origin"] === "*"); - assert.ok(res.vary === undefined); - assert.ok(res["access-control-expose-headers"] !== undefined); + assert.ok(getResponseHeader(res, "access-control-allow-origin") === "*"); + assert.ok(getResponseHeader(res, "vary") === undefined); + assert.ok(getResponseHeader(res, "access-control-expose-headers") !== undefined); res = await serviceClient.getProperties(); - assert.ok(res["access-control-allow-origin"] === undefined); - assert.ok(res.vary === undefined); - assert.ok(res["access-control-expose-headers"] === undefined); + assert.ok(getResponseHeader(res, "access-control-allow-origin") === undefined); + assert.ok(getResponseHeader(res, "vary") === undefined); + assert.ok(getResponseHeader(res, "access-control-expose-headers") === undefined); }); it("Request Match rule exists for exact origin @loki @sql", async () => { @@ -749,9 +750,9 @@ describe("Blob Cors requests test", () => { const serviceClientWithOrigin = new BlobServiceClient(baseURL, pipeline); const res: any = await serviceClientWithOrigin.getProperties(); - assert.ok(res["access-control-allow-origin"] === origin); - assert.ok(res.vary !== undefined); - assert.ok(res["access-control-expose-headers"] !== undefined); + assert.ok(getResponseHeader(res, "access-control-allow-origin") === origin); + assert.ok(getResponseHeader(res, "vary") !== undefined); + assert.ok(getResponseHeader(res, "access-control-expose-headers") !== undefined); }); it("Requests with error response should apply for CORS @loki @sql", async () => { @@ -793,13 +794,11 @@ describe("Blob Cors requests test", () => { await containerClientWithOrigin.getProperties(); } catch (err) { assert.ok( - err.response.headers._headersMap["access-control-allow-origin"] - .value === origin + err.response.headers.get("access-control-allow-origin") === origin ); - assert.ok(err.response.headers._headersMap.vary !== undefined); + assert.ok(err.response.headers.get("vary") !== undefined); assert.ok( - err.response.headers._headersMap["access-control-expose-headers"] !== - undefined + err.response.headers.get("access-control-expose-headers") !== undefined ); } }); @@ -846,8 +845,8 @@ describe("Blob Cors requests test", () => { const serviceClientWithOrigin = new BlobServiceClient(baseURL, pipeline); const res: any = await serviceClientWithOrigin.getProperties(); - assert.ok(res["access-control-allow-origin"] === origin); - assert.ok(res.vary !== undefined); - assert.ok(res["access-control-expose-headers"] !== undefined); + assert.ok(getResponseHeader(res, "access-control-allow-origin") === origin); + assert.ok(getResponseHeader(res, "vary") !== undefined); + assert.ok(getResponseHeader(res, "access-control-expose-headers") !== undefined); }); }); diff --git a/tests/blob/oauth.test.ts b/tests/blob/oauth.test.ts index ad5b8fdaf..76f6e1040 100644 --- a/tests/blob/oauth.test.ts +++ b/tests/blob/oauth.test.ts @@ -578,7 +578,7 @@ describe("Blob OAuth Basic", () => { err.message.includes("Server failed to authenticate the request."), true ); - assert.deepStrictEqual(err.details.AuthenticationErrorDetail.includes("audience"), true); + assert.deepStrictEqual(err.details.authenticationErrorDetail.includes("audience"), true); return; } assert.fail(); @@ -653,7 +653,7 @@ describe("Blob OAuth Basic", () => { err.message.includes("Server failed to authenticate the request."), true ); - assert.deepStrictEqual(err.details.AuthenticationErrorDetail.includes("issuer"), true); + assert.deepStrictEqual(err.details.authenticationErrorDetail.includes("issuer"), true); return; } assert.fail(); @@ -691,7 +691,7 @@ describe("Blob OAuth Basic", () => { err.message.includes("Server failed to authenticate the request."), true ); - assert.deepStrictEqual(err.details.AuthenticationErrorDetail.includes("Lifetime"), true); + assert.deepStrictEqual(err.details.authenticationErrorDetail.includes("Lifetime"), true); return; } assert.fail(); @@ -729,7 +729,7 @@ describe("Blob OAuth Basic", () => { err.message.includes("Server failed to authenticate the request."), true ); - assert.deepStrictEqual(err.details.AuthenticationErrorDetail.includes("expire"), true); + assert.deepStrictEqual(err.details.authenticationErrorDetail.includes("expire"), true); return; } assert.fail(); diff --git a/tests/blob/sas.test.ts b/tests/blob/sas.test.ts index 956f10f2d..213c290b6 100644 --- a/tests/blob/sas.test.ts +++ b/tests/blob/sas.test.ts @@ -123,8 +123,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const startDate = new Date(2022, 3, 16, 14, 31, 48, 0); const endDate = new Date(2022, 3, 17, 14, 31, 48, 0); - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -182,9 +181,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -219,9 +216,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -263,9 +258,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -300,9 +293,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -337,9 +328,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -377,9 +366,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -425,9 +412,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -480,9 +465,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -527,9 +510,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -575,9 +556,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -630,9 +609,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const sas = generateAccountSASQueryParameters( { @@ -681,9 +658,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -719,9 +694,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -777,9 +750,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -842,9 +813,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -890,9 +859,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -938,9 +905,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClientInvalid as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClientInvalid.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -988,9 +953,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClientSecondKey as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClientSecondKey.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1026,9 +989,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1092,9 +1053,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1161,9 +1120,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1228,9 +1185,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1294,9 +1249,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1361,9 +1314,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container-with-dash"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1432,9 +1383,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1485,9 +1434,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1532,9 +1479,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1586,9 +1531,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1631,9 +1574,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1678,9 +1619,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1732,9 +1671,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1777,9 +1714,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const storageSharedKeyCredential = factories[factories.length - 1]; + const storageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("container"); const containerClient = serviceClient.getContainerClient(containerName); @@ -1845,9 +1780,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("con"); const sourceContainerClient = serviceClient.getContainerClient( @@ -2004,9 +1937,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("con"); const sourceContainerClient = serviceClient.getContainerClient( @@ -2079,9 +2010,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("con"); const sourceContainerClient = serviceClient.getContainerClient( @@ -2132,9 +2061,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const tmr = new Date(); tmr.setDate(tmr.getDate() + 1); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential; const containerName = getUniqueName("con"); const sourceContainerClient = serviceClient.getContainerClient( @@ -2254,9 +2181,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const blockBlobClient = containerClient.getBlockBlobClient(blockBlobName); await blockBlobClient.upload("Hello, world", 12, { tags: tags }); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; const sasURL = generateAccountSASQueryParameters({ expiresOn: tmr, @@ -2298,9 +2223,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const blockBlobClient = containerClient.getBlockBlobClient(blockBlobName); await blockBlobClient.upload("Hello, world", 12, { tags: tags }); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; const sasURL = generateAccountSASQueryParameters({ expiresOn: tmr, @@ -2374,9 +2297,7 @@ describe("Shared Access Signature (SAS) authentication", () => { const blockBlobClient = containerClient.getBlockBlobClient(blockBlobName); await blockBlobClient.upload("Hello, world", 12); - // By default, credential is always the last element of pipeline factories - const factories = (serviceClient as any).pipeline.factories; - const sourceStorageSharedKeyCredential = factories[factories.length - 1]; + const sourceStorageSharedKeyCredential = serviceClient.credential as StorageSharedKeyCredential; const sasURL = generateAccountSASQueryParameters({ expiresOn: tmr, diff --git a/tests/testutils.ts b/tests/testutils.ts index 86c214622..e3a1f2a92 100644 --- a/tests/testutils.ts +++ b/tests/testutils.ts @@ -145,7 +145,7 @@ export async function createRandomLocalFile( ws.on("open", () => { // tslint:disable-next-line:no-empty - while (offsetInMB++ < blockNumber && ws.write(randomValueHex())) {} + while (offsetInMB++ < blockNumber && ws.write(randomValueHex())) { } if (offsetInMB >= blockNumber) { ws.end(); } @@ -153,7 +153,7 @@ export async function createRandomLocalFile( ws.on("drain", () => { // tslint:disable-next-line:no-empty - while (offsetInMB++ < blockNumber && ws.write(randomValueHex())) {} + while (offsetInMB++ < blockNumber && ws.write(randomValueHex())) { } if (offsetInMB >= blockNumber) { ws.end(); } @@ -251,3 +251,13 @@ export function overrideRequest( ); }; } + +export function getResponseHeader(res: any, headerName: string): string | undefined { + return res._response.headers.get(headerName); + if (res._response.headers._headersMap[headerName] === undefined) { + return undefined; + } + else { + return res._response.headers._headersMap[headerName].value; + } +} \ No newline at end of file