[Tables] Take base64 string when inserting a binary through metadata object (#18251)

* Take base64 string when inserting a binary through metadata object

* Change long test name

* Update changelog
This commit is contained in:
Jose Manuel Heredia Hidalgo 2021-11-09 13:14:01 -08:00 коммит произвёл GitHub
Родитель 5e08292328
Коммит 43143dd5ca
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 807 добавлений и 10 удалений

Просмотреть файл

@ -1,6 +1,6 @@
# Release History
## 13.0.0 (Unreleased)
## 13.0.0 (2021-11-09)
### Features Added
@ -9,7 +9,8 @@
### Breaking Changes
- Encode single quote where the partition/row key is used to format the URL - i.e. upsert, update and delete. For more details see [#3356](https://github.com/Azure/azure-sdk/issues/3356)
- Encode single quote where the partition/row key is used to format the URL - i.e. upsert, update and delete. For more details see Issue [#3356](https://github.com/Azure/azure-sdk/issues/3356). Fixed in [#18520](https://github.com/Azure/azure-sdk-for-js/pull/18520)
- Setting a binary property on an entity without automatic type conversion takes raw string instead of Uint8Array [#18251](https://github.com/Azure/azure-sdk-for-js/pull/18251)
### Bugs Fixed

Просмотреть файл

@ -0,0 +1,53 @@
{
"recordings": [
{
"method": "POST",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser",
"query": {},
"requestBody": "{\"PartitionKey\":\"CreateBinary_SASConnectionStringbrowser\",\"RowKey\":\"first_SASConnectionStringbrowser\",\"binary\":\"QmFy\",\"binary@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\"}",
"status": 204,
"response": "",
"responseHeaders": {
"cache-control": "no-cache",
"content-length": "0",
"dataserviceid": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='first_SASConnectionStringbrowser')",
"date": "Mon, 18 Oct 2021 19:42:47 GMT",
"etag": "W/\"datetime'2021-10-18T19%3A42%3A48.6976103Z'\"",
"location": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='first_SASConnectionStringbrowser')",
"preference-applied": "return-no-content",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "281c5f32-9d6f-47db-90a8-c6e8565fa3d8",
"x-ms-request-id": "b251709a-9002-00d2-1658-c43fe7000000",
"x-ms-version": "2019-02-02"
}
},
{
"method": "GET",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='first_SASConnectionStringbrowser')",
"query": {},
"requestBody": null,
"status": 200,
"response": "{\"odata.metadata\":\"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestSASConnectionStringbrowser/@Element\",\"odata.etag\":\"W/\\\"datetime'2021-10-18T19%3A42%3A48.6976103Z'\\\"\",\"PartitionKey\":\"CreateBinary_SASConnectionStringbrowser\",\"RowKey\":\"first_SASConnectionStringbrowser\",\"Timestamp\":\"2021-10-18T19:42:48.6976103Z\",\"binary@odata.type\":\"Edm.Binary\",\"binary\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\"}",
"responseHeaders": {
"access-control-allow-origin": "*",
"access-control-expose-headers": "x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding",
"cache-control": "no-cache",
"content-type": "application/json;odata=minimalmetadata;streaming=true;charset=utf-8",
"date": "Mon, 18 Oct 2021 19:42:47 GMT",
"etag": "W/\"datetime'2021-10-18T19%3A42%3A48.6976103Z'\"",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"transfer-encoding": "chunked",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "794e5705-24d5-4bd2-966f-8c7cb63761e7",
"x-ms-request-id": "b25170b4-9002-00d2-3058-c43fe7000000",
"x-ms-version": "2019-02-02"
}
}
],
"uniqueTestInfo": {
"uniqueName": {},
"newDate": {}
},
"hash": "6c66c901eab0aa18458c18ba221ee58f"
}

Просмотреть файл

@ -0,0 +1,53 @@
{
"recordings": [
{
"method": "POST",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser",
"query": {},
"requestBody": "{\"PartitionKey\":\"CreateBinary_SASConnectionStringbrowser\",\"RowKey\":\"second_SASConnectionStringbrowser\",\"binary\":\"QmFy\",\"binary@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\"}",
"status": 204,
"response": "",
"responseHeaders": {
"cache-control": "no-cache",
"content-length": "0",
"dataserviceid": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='second_SASConnectionStringbrowser')",
"date": "Mon, 18 Oct 2021 20:22:06 GMT",
"etag": "W/\"datetime'2021-10-18T20%3A22%3A06.2988577Z'\"",
"location": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='second_SASConnectionStringbrowser')",
"preference-applied": "return-no-content",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "10cbf332-2eb3-4512-9d32-d386b27ef8af",
"x-ms-request-id": "fd977c27-3002-0135-635d-c469bf000000",
"x-ms-version": "2019-02-02"
}
},
{
"method": "GET",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringbrowser(PartitionKey='CreateBinary_SASConnectionStringbrowser',RowKey='second_SASConnectionStringbrowser')",
"query": {},
"requestBody": null,
"status": 200,
"response": "{\"odata.metadata\":\"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestSASConnectionStringbrowser/@Element\",\"odata.etag\":\"W/\\\"datetime'2021-10-18T20%3A22%3A06.2988577Z'\\\"\",\"PartitionKey\":\"CreateBinary_SASConnectionStringbrowser\",\"RowKey\":\"second_SASConnectionStringbrowser\",\"Timestamp\":\"2021-10-18T20:22:06.2988577Z\",\"binary@odata.type\":\"Edm.Binary\",\"binary\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\"}",
"responseHeaders": {
"access-control-allow-origin": "*",
"access-control-expose-headers": "x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding",
"cache-control": "no-cache",
"content-type": "application/json;odata=minimalmetadata;streaming=true;charset=utf-8",
"date": "Mon, 18 Oct 2021 20:22:06 GMT",
"etag": "W/\"datetime'2021-10-18T20%3A22%3A06.2988577Z'\"",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"transfer-encoding": "chunked",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "9c9189b6-9082-4f4c-acc8-89ed8180c6c0",
"x-ms-request-id": "fd977c31-3002-0135-6d5d-c469bf000000",
"x-ms-version": "2019-02-02"
}
}
],
"uniqueTestInfo": {
"uniqueName": {},
"newDate": {}
},
"hash": "cc515de6566de9b77d0471c50da32cd5"
}

Просмотреть файл

@ -0,0 +1,77 @@
{
"recordings": [
{
"method": "POST",
"url": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token",
"query": {},
"requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fsanitized%2F",
"status": 200,
"response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"access_token\"}",
"responseHeaders": {
"cache-control": "no-store, no-cache",
"content-length": "1318",
"content-type": "application/json; charset=utf-8",
"date": "Mon, 18 Oct 2021 19:42:47 GMT",
"expires": "-1",
"nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}",
"p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"",
"pragma": "no-cache",
"referrer-policy": "strict-origin-when-cross-origin",
"report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://identity.nel.measure.office.net/api/report?catId=GW+estsfd+wst\"}]}",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"x-content-type-options": "nosniff",
"x-ms-ests-server": "2.1.12158.6 - SCUS ProdSlices",
"x-ms-request-id": "2a99fc88-f797-4857-8480-f0d167299f00"
}
},
{
"method": "POST",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser",
"query": {},
"requestBody": "{\"PartitionKey\":\"CreateBinary_TokenCredentialbrowser\",\"RowKey\":\"first_TokenCredentialbrowser\",\"binary\":\"QmFy\",\"binary@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\"}",
"status": 204,
"response": "",
"responseHeaders": {
"cache-control": "no-cache",
"content-length": "0",
"dataserviceid": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='first_TokenCredentialbrowser')",
"date": "Mon, 18 Oct 2021 19:42:47 GMT",
"etag": "W/\"datetime'2021-10-18T19%3A42%3A48.3043302Z'\"",
"location": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='first_TokenCredentialbrowser')",
"preference-applied": "return-no-content",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "5a70f7a3-6eec-4eb7-b275-d57388ccc57b",
"x-ms-request-id": "b2516fd7-9002-00d2-5f58-c43fe7000000",
"x-ms-version": "2019-02-02"
}
},
{
"method": "GET",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='first_TokenCredentialbrowser')",
"query": {},
"requestBody": null,
"status": 200,
"response": "{\"odata.metadata\":\"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestTokenCredentialbrowser/@Element\",\"odata.etag\":\"W/\\\"datetime'2021-10-18T19%3A42%3A48.3043302Z'\\\"\",\"PartitionKey\":\"CreateBinary_TokenCredentialbrowser\",\"RowKey\":\"first_TokenCredentialbrowser\",\"Timestamp\":\"2021-10-18T19:42:48.3043302Z\",\"binary@odata.type\":\"Edm.Binary\",\"binary\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\"}",
"responseHeaders": {
"access-control-allow-origin": "*",
"access-control-expose-headers": "x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding",
"cache-control": "no-cache",
"content-type": "application/json;odata=minimalmetadata;streaming=true;charset=utf-8",
"date": "Mon, 18 Oct 2021 19:42:47 GMT",
"etag": "W/\"datetime'2021-10-18T19%3A42%3A48.3043302Z'\"",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"transfer-encoding": "chunked",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "c20bf73d-8405-41ce-91c3-57b28b2f6447",
"x-ms-request-id": "b2516fe7-9002-00d2-6f58-c43fe7000000",
"x-ms-version": "2019-02-02"
}
}
],
"uniqueTestInfo": {
"uniqueName": {},
"newDate": {}
},
"hash": "6c66c901eab0aa18458c18ba221ee58f"
}

Просмотреть файл

@ -0,0 +1,77 @@
{
"recordings": [
{
"method": "POST",
"url": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token",
"query": {},
"requestBody": "response_type=token&grant_type=client_credentials&client_id=azure_client_id&client_secret=azure_client_secret&scope=https%3A%2F%2Fsanitized%2F",
"status": 200,
"response": "{\"token_type\":\"Bearer\",\"expires_in\":86399,\"ext_expires_in\":86399,\"access_token\":\"access_token\"}",
"responseHeaders": {
"cache-control": "no-store, no-cache",
"content-length": "1318",
"content-type": "application/json; charset=utf-8",
"date": "Mon, 18 Oct 2021 20:22:05 GMT",
"expires": "-1",
"nel": "{\"report_to\":\"network-errors\",\"max_age\":86400,\"success_fraction\":0.001,\"failure_fraction\":1.0}",
"p3p": "CP=\"DSP CUR OTPi IND OTRi ONL FIN\"",
"pragma": "no-cache",
"referrer-policy": "strict-origin-when-cross-origin",
"report-to": "{\"group\":\"network-errors\",\"max_age\":86400,\"endpoints\":[{\"url\":\"https://identity.nel.measure.office.net/api/report?catId=GW+estsfd+est\"}]}",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"x-content-type-options": "nosniff",
"x-ms-ests-server": "2.1.12158.6 - WUS2 ProdSlices",
"x-ms-request-id": "5e1ff52c-d610-4de3-9dc9-68dc3a6aa500"
}
},
{
"method": "POST",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser",
"query": {},
"requestBody": "{\"PartitionKey\":\"CreateBinary_TokenCredentialbrowser\",\"RowKey\":\"second_TokenCredentialbrowser\",\"binary\":\"QmFy\",\"binary@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\"}",
"status": 204,
"response": "",
"responseHeaders": {
"cache-control": "no-cache",
"content-length": "0",
"dataserviceid": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='second_TokenCredentialbrowser')",
"date": "Mon, 18 Oct 2021 20:22:06 GMT",
"etag": "W/\"datetime'2021-10-18T20%3A22%3A06.0696935Z'\"",
"location": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='second_TokenCredentialbrowser')",
"preference-applied": "return-no-content",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "fda2fcf2-8357-4906-a755-a5cc0b8f0549",
"x-ms-request-id": "fd977bf0-3002-0135-2f5d-c469bf000000",
"x-ms-version": "2019-02-02"
}
},
{
"method": "GET",
"url": "https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialbrowser(PartitionKey='CreateBinary_TokenCredentialbrowser',RowKey='second_TokenCredentialbrowser')",
"query": {},
"requestBody": null,
"status": 200,
"response": "{\"odata.metadata\":\"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestTokenCredentialbrowser/@Element\",\"odata.etag\":\"W/\\\"datetime'2021-10-18T20%3A22%3A06.0696935Z'\\\"\",\"PartitionKey\":\"CreateBinary_TokenCredentialbrowser\",\"RowKey\":\"second_TokenCredentialbrowser\",\"Timestamp\":\"2021-10-18T20:22:06.0696935Z\",\"binary@odata.type\":\"Edm.Binary\",\"binary\":\"QmFy\",\"binaryMetadata@odata.type\":\"Edm.Binary\",\"binaryMetadata\":\"QmFy\"}",
"responseHeaders": {
"access-control-allow-origin": "*",
"access-control-expose-headers": "x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding",
"cache-control": "no-cache",
"content-type": "application/json;odata=minimalmetadata;streaming=true;charset=utf-8",
"date": "Mon, 18 Oct 2021 20:22:06 GMT",
"etag": "W/\"datetime'2021-10-18T20%3A22%3A06.0696935Z'\"",
"server": "Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0",
"transfer-encoding": "chunked",
"x-content-type-options": "nosniff",
"x-ms-client-request-id": "3e51d583-3855-46ad-94be-3ec5ff011010",
"x-ms-request-id": "fd977bf8-3002-0135-375d-c469bf000000",
"x-ms-version": "2019-02-02"
}
}
],
"uniqueTestInfo": {
"uniqueName": {},
"newDate": {}
},
"hash": "cc515de6566de9b77d0471c50da32cd5"
}

Просмотреть файл

@ -0,0 +1,65 @@
let nock = require('nock');
module.exports.hash = "65cc82d96f05ba1e9b1cd10656750bd7";
module.exports.testInfo = {"uniqueName":{},"newDate":{}}
nock('https://fakeaccount.table.core.windows.net:443', {"encodedQueryParams":true})
.post('/tableClientTestSASConnectionStringnode', {"PartitionKey":"CreateBinary_SASConnectionStringnode","RowKey":"first_SASConnectionStringnode","binary":"QmFy","binary@odata.type":"Edm.Binary","binaryMetadata":"QmFy","binaryMetadata@odata.type":"Edm.Binary"})
.query(true)
.reply(204, "", [
'Cache-Control',
'no-cache',
'Content-Length',
'0',
'ETag',
`W/"datetime'2021-10-18T19%3A42%3A39.8159151Z'"`,
'Location',
"https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='first_SASConnectionStringnode')",
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'edc5c464-a002-00b7-7b58-c48eba000000',
'x-ms-client-request-id',
'c1f90852-0b69-46ed-8830-3e2474001326',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Preference-Applied',
'return-no-content',
'DataServiceId',
"https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='first_SASConnectionStringnode')",
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT'
]);
nock('https://fakeaccount.table.core.windows.net:443', {"encodedQueryParams":true})
.get(`/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='first_SASConnectionStringnode')`)
.query(true)
.reply(200, {"odata.metadata":"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestSASConnectionStringnode/@Element","odata.etag":"W/\"datetime'2021-10-18T19%3A42%3A39.8159151Z'\"","PartitionKey":"CreateBinary_SASConnectionStringnode","RowKey":"first_SASConnectionStringnode","Timestamp":"2021-10-18T19:42:39.8159151Z","binary@odata.type":"Edm.Binary","binary":"QmFy","binaryMetadata@odata.type":"Edm.Binary","binaryMetadata":"QmFy"}, [
'Cache-Control',
'no-cache',
'Transfer-Encoding',
'chunked',
'Content-Type',
'application/json;odata=minimalmetadata;streaming=true;charset=utf-8',
'ETag',
`W/"datetime'2021-10-18T19%3A42%3A39.8159151Z'"`,
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'edc5c47d-a002-00b7-1258-c48eba000000',
'x-ms-client-request-id',
'110fbefd-6e57-4c1c-88dc-a0081b9e2ca0',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Expose-Headers',
'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding',
'Access-Control-Allow-Origin',
'*',
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT'
]);

Просмотреть файл

@ -0,0 +1,65 @@
let nock = require('nock');
module.exports.hash = "80cf87fdd21f28e690711cf1fa09c675";
module.exports.testInfo = {"uniqueName":{},"newDate":{}}
nock('https://fakeaccount.table.core.windows.net:443', {"encodedQueryParams":true})
.post('/tableClientTestSASConnectionStringnode', {"PartitionKey":"CreateBinary_SASConnectionStringnode","RowKey":"second_SASConnectionStringnode","binary":"QmFy","binary@odata.type":"Edm.Binary","binaryMetadata":"QmFy","binaryMetadata@odata.type":"Edm.Binary"})
.query(true)
.reply(204, "", [
'Cache-Control',
'no-cache',
'Content-Length',
'0',
'ETag',
`W/"datetime'2021-10-18T20%3A22%3A00.7019109Z'"`,
'Location',
"https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='second_SASConnectionStringnode')",
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'483254cb-c002-0060-3e5d-c4c49d000000',
'x-ms-client-request-id',
'255ea98e-d667-4d8a-98ef-3964258aa8db',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Preference-Applied',
'return-no-content',
'DataServiceId',
"https://fakeaccount.table.core.windows.net/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='second_SASConnectionStringnode')",
'Date',
'Mon, 18 Oct 2021 20:22:00 GMT'
]);
nock('https://fakeaccount.table.core.windows.net:443', {"encodedQueryParams":true})
.get(`/tableClientTestSASConnectionStringnode(PartitionKey='CreateBinary_SASConnectionStringnode',RowKey='second_SASConnectionStringnode')`)
.query(true)
.reply(200, {"odata.metadata":"https://fakeaccount.table.core.windows.net/$metadata#tableClientTestSASConnectionStringnode/@Element","odata.etag":"W/\"datetime'2021-10-18T20%3A22%3A00.7019109Z'\"","PartitionKey":"CreateBinary_SASConnectionStringnode","RowKey":"second_SASConnectionStringnode","Timestamp":"2021-10-18T20:22:00.7019109Z","binary@odata.type":"Edm.Binary","binary":"QmFy","binaryMetadata@odata.type":"Edm.Binary","binaryMetadata":"QmFy"}, [
'Cache-Control',
'no-cache',
'Transfer-Encoding',
'chunked',
'Content-Type',
'application/json;odata=minimalmetadata;streaming=true;charset=utf-8',
'ETag',
`W/"datetime'2021-10-18T20%3A22%3A00.7019109Z'"`,
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'483254d6-c002-0060-495d-c4c49d000000',
'x-ms-client-request-id',
'88a144a1-b98c-4e52-b472-a5b3afd87084',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Expose-Headers',
'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding',
'Access-Control-Allow-Origin',
'*',
'Date',
'Mon, 18 Oct 2021 20:22:00 GMT'
]);

Просмотреть файл

@ -0,0 +1,169 @@
let nock = require('nock');
module.exports.hash = "65cc82d96f05ba1e9b1cd10656750bd7";
module.exports.testInfo = { "uniqueName": {}, "newDate": {} }
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.get('/common/discovery/instance')
.query(true)
.reply(200, { "tenant_discovery_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, [
'Cache-Control',
'max-age=86400, private',
'Content-Type',
'application/json; charset=utf-8',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Allow-Methods',
'GET, OPTIONS',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'0e004fe4-400b-4779-9b28-aa6b05df6501',
'x-ms-ests-server',
'2.1.12108.11 - EUS ProdSlices',
'Set-Cookie',
'fpc=ArwFvKPxSsBMmNSHW9NnmSA; expires=Wed, 17-Nov-2021 19:42:39 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrq7XqCLCSz24LxDGqHuAKPboKKFb6I4T8336ANXnchKGHyZgTuQdn4UxonlgBbub6v1MaIZGo_r3uXbHTELd_Z8Ka5hNBLLlu7Uj_OuX7r461H3qVy9RQdOkLUZj22casPRYEpUzMJPWXtBldwlrHbN5xll_YAY-m9RmETRxzAtEgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT',
'Content-Length',
'980'
]);
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration')
.reply(200, { "token_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos", "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, [
'Cache-Control',
'max-age=86400, private',
'Content-Type',
'application/json; charset=utf-8',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Allow-Methods',
'GET, OPTIONS',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'37cb551b-4d63-4b53-87e9-8b9f9f628000',
'x-ms-ests-server',
'2.1.12158.6 - NCUS ProdSlices',
'Set-Cookie',
'fpc=AvB2tYOJh_BAu7cGkG_KBcA; expires=Wed, 17-Nov-2021 19:42:39 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevrng28AB149NKPDlU3UQ-iiXQNmW7Yx5tbk2pzeUwC1dTwUKEepmte8n1_8liK01FkXJqEoSdc7wxcHH0K7lxfLL-IOnzv7UuyC9CGzkNyNcvK3-iQG2CGkOIRpiSkyCoN-2OkuwKP-gfk-k1IZdwM3bnFGRfJIeVaJtwYyuoIRiQgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT',
'Content-Length',
'1753'
]);
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.2&x-client-OS=linux&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=d5f70274-165d-4572-8dad-9e805501a56c&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D")
.reply(200, { "token_type": "Bearer", "expires_in": 86399, "ext_expires_in": 86399, "access_token": "access_token" }, [
'Cache-Control',
'no-store, no-cache',
'Pragma',
'no-cache',
'Content-Type',
'application/json; charset=utf-8',
'Expires',
'-1',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'5aa96ab2-0a65-488b-a4db-ae8e890d9100',
'x-ms-ests-server',
'2.1.12158.6 - SCUS ProdSlices',
'x-ms-clitelem',
'1,0,0,,',
'Set-Cookie',
'fpc=AiFpeoGwlAVNm421HTupP6HJVDEwAQAAAC_F_9gOAAAA; expires=Wed, 17-Nov-2021 19:42:39 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT',
'Content-Length',
'1318'
]);
nock('https://fakeaccount.table.core.windows.net:443', { "encodedQueryParams": true })
.post('/tableClientTestTokenCredentialnode', { "PartitionKey": "CreateBinary_TokenCredentialnode", "RowKey": "first_TokenCredentialnode", "binary": "QmFy", "binary@odata.type": "Edm.Binary", "binaryMetadata": "QmFy", "binaryMetadata@odata.type": "Edm.Binary" })
.reply(204, "", [
'Cache-Control',
'no-cache',
'Content-Length',
'0',
'ETag',
`W/"datetime'2021-10-18T19%3A42%3A39.3285723Z'"`,
'Location',
"https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='first_TokenCredentialnode')",
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'edc5c38f-a002-00b7-3258-c48eba000000',
'x-ms-client-request-id',
'77fa962d-3034-49ca-8de4-967b0edd70fa',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Preference-Applied',
'return-no-content',
'DataServiceId',
"https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='first_TokenCredentialnode')",
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT'
]);
nock('https://fakeaccount.table.core.windows.net:443', { "encodedQueryParams": true })
.get(`/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='first_TokenCredentialnode')`)
.reply(200, { "odata.metadata": "https://fakeaccount.table.core.windows.net/$metadata#tableClientTestTokenCredentialnode/@Element", "odata.etag": "W/\"datetime'2021-10-18T19%3A42%3A39.3285723Z'\"", "PartitionKey": "CreateBinary_TokenCredentialnode", "RowKey": "first_TokenCredentialnode", "Timestamp": "2021-10-18T19:42:39.3285723Z", "binary@odata.type": "Edm.Binary", "binary": "QmFy", "binaryMetadata@odata.type": "Edm.Binary", "binaryMetadata": "QmFy" }, [
'Cache-Control',
'no-cache',
'Transfer-Encoding',
'chunked',
'Content-Type',
'application/json;odata=minimalmetadata;streaming=true;charset=utf-8',
'ETag',
`W/"datetime'2021-10-18T19%3A42%3A39.3285723Z'"`,
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'edc5c39d-a002-00b7-3c58-c48eba000000',
'x-ms-client-request-id',
'98dcd8a1-6fe6-48ee-a400-16327de4059b',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Expose-Headers',
'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding',
'Access-Control-Allow-Origin',
'*',
'Date',
'Mon, 18 Oct 2021 19:42:38 GMT'
]);

Просмотреть файл

@ -0,0 +1,169 @@
let nock = require('nock');
module.exports.hash = "80cf87fdd21f28e690711cf1fa09c675";
module.exports.testInfo = { "uniqueName": {}, "newDate": {} }
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.get('/common/discovery/instance')
.query(true)
.reply(200, { "tenant_discovery_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, [
'Cache-Control',
'max-age=86400, private',
'Content-Type',
'application/json; charset=utf-8',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Allow-Methods',
'GET, OPTIONS',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'5cabe536-e953-4b0d-ac70-002561d52501',
'x-ms-ests-server',
'2.1.12108.10 - SCUS ProdSlices',
'Set-Cookie',
'fpc=AqR2b7P-tWpJpRUMAZjH1DY; expires=Wed, 17-Nov-2021 20:22:00 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7WevrlpHRdevRXxOMkkldqWYNxfCiwygK_l9AMT1VKqpsnewgzwQrHkVJAjsVB5q1zJRJPK0titZJ8o4GAJIJCUpQZBLaUTTmEy-EHQ5fUmuLiTsJie1UxsX-9pMH44jx0i8ZMhx7I32P_qQz5SmJILDdihHlKcW7TFzeXmhyeXBC4RQgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 20:21:59 GMT',
'Content-Length',
'980'
]);
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.get('/88888888-8888-8888-8888-888888888888/v2.0/.well-known/openid-configuration')
.reply(200, { "token_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/88888888-8888-8888-8888-888888888888/kerberos", "tenant_region_scope": "WW", "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, [
'Cache-Control',
'max-age=86400, private',
'Content-Type',
'application/json; charset=utf-8',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Allow-Origin',
'*',
'Access-Control-Allow-Methods',
'GET, OPTIONS',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'97928f70-5761-4fa3-9bd2-a217f1da9200',
'x-ms-ests-server',
'2.1.12158.6 - NCUS ProdSlices',
'Set-Cookie',
'fpc=AnwViRw6GoRJgunR9PkNFUE; expires=Wed, 17-Nov-2021 20:22:00 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'esctx=AQABAAAAAAD--DLA3VO7QrddgJg7Wevr5Pwo2Wyp5qx7_1DbOstV-WExW6Zhmsdp2uNJL4m7GD9CUdgfNMwkcFK94VWbPhq8ng7ioTzpwNHi22Am9NDdnXVN3D4GRNIeAvhXr7Ftri34f-2Hz8vzsJcyPk0096flor3ea-GwW2YIgSGzwaNlRC5RyhBhXbbcD_hbKLX1vXIgAA; domain=.login.microsoftonline.com; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 20:21:59 GMT',
'Content-Length',
'1753'
]);
nock('https://login.microsoftonline.com:443', { "encodedQueryParams": true })
.post('/88888888-8888-8888-8888-888888888888/oauth2/v2.0/token', "client_id=azure_client_id&scope=https%3A%2F%2Fsanitized%2F&grant_type=client_credentials&x-client-SKU=msal.js.node&x-client-VER=1.3.2&x-client-OS=linux&x-client-CPU=x64&x-ms-lib-capability=retry-after, h429&x-client-current-telemetry=5|771,2,,,|,&x-client-last-telemetry=5|0|||0,0&client-request-id=4417f104-cff2-4f38-92bb-6bb0cb554f4e&client_secret=azure_client_secret&claims=%7B%22access_token%22%3A%7B%22xms_cc%22%3A%7B%22values%22%3A%5B%22CP1%22%5D%7D%7D%7D")
.reply(200, { "token_type": "Bearer", "expires_in": 86399, "ext_expires_in": 86399, "access_token": "access_token" }, [
'Cache-Control',
'no-store, no-cache',
'Pragma',
'no-cache',
'Content-Type',
'application/json; charset=utf-8',
'Expires',
'-1',
'Strict-Transport-Security',
'max-age=31536000; includeSubDomains',
'X-Content-Type-Options',
'nosniff',
'P3P',
'CP="DSP CUR OTPi IND OTRi ONL FIN"',
'x-ms-request-id',
'd0c2953f-89af-4397-b681-1844a7308b00',
'x-ms-ests-server',
'2.1.12158.6 - NCUS ProdSlices',
'x-ms-clitelem',
'1,0,0,,',
'Set-Cookie',
'fpc=AgMZ833xWHNPk6UXuSlLrh7JVDEwAQAAAGfO_9gOAAAA; expires=Wed, 17-Nov-2021 20:22:00 GMT; path=/; secure; HttpOnly; SameSite=None',
'Set-Cookie',
'x-ms-gateway-slice=estsfd; path=/; secure; samesite=none; httponly',
'Set-Cookie',
'stsservicecookie=estsfd; path=/; secure; samesite=none; httponly',
'Date',
'Mon, 18 Oct 2021 20:21:59 GMT',
'Content-Length',
'1318'
]);
nock('https://fakeaccount.table.core.windows.net:443', { "encodedQueryParams": true })
.post('/tableClientTestTokenCredentialnode', { "PartitionKey": "CreateBinary_TokenCredentialnode", "RowKey": "second_TokenCredentialnode", "binary": "QmFy", "binary@odata.type": "Edm.Binary", "binaryMetadata": "QmFy", "binaryMetadata@odata.type": "Edm.Binary" })
.reply(204, "", [
'Cache-Control',
'no-cache',
'Content-Length',
'0',
'ETag',
`W/"datetime'2021-10-18T20%3A22%3A00.5097754Z'"`,
'Location',
"https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='second_TokenCredentialnode')",
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'48325493-c002-0060-095d-c4c49d000000',
'x-ms-client-request-id',
'bd7c6406-e40a-484e-9715-05466c3261e8',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Preference-Applied',
'return-no-content',
'DataServiceId',
"https://fakeaccount.table.core.windows.net/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='second_TokenCredentialnode')",
'Date',
'Mon, 18 Oct 2021 20:22:00 GMT'
]);
nock('https://fakeaccount.table.core.windows.net:443', { "encodedQueryParams": true })
.get(`/tableClientTestTokenCredentialnode(PartitionKey='CreateBinary_TokenCredentialnode',RowKey='second_TokenCredentialnode')`)
.reply(200, { "odata.metadata": "https://fakeaccount.table.core.windows.net/$metadata#tableClientTestTokenCredentialnode/@Element", "odata.etag": "W/\"datetime'2021-10-18T20%3A22%3A00.5097754Z'\"", "PartitionKey": "CreateBinary_TokenCredentialnode", "RowKey": "second_TokenCredentialnode", "Timestamp": "2021-10-18T20:22:00.5097754Z", "binary@odata.type": "Edm.Binary", "binary": "QmFy", "binaryMetadata@odata.type": "Edm.Binary", "binaryMetadata": "QmFy" }, [
'Cache-Control',
'no-cache',
'Transfer-Encoding',
'chunked',
'Content-Type',
'application/json;odata=minimalmetadata;streaming=true;charset=utf-8',
'ETag',
`W/"datetime'2021-10-18T20%3A22%3A00.5097754Z'"`,
'Server',
'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
'x-ms-request-id',
'483254a2-c002-0060-185d-c4c49d000000',
'x-ms-client-request-id',
'606ae6bf-2f18-43ea-8364-805b52c505de',
'x-ms-version',
'2019-02-02',
'X-Content-Type-Options',
'nosniff',
'Access-Control-Expose-Headers',
'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,X-Content-Type-Options,Cache-Control,ETag,Content-Type,Content-Length,Date,Transfer-Encoding',
'Access-Control-Allow-Origin',
'*',
'Date',
'Mon, 18 Oct 2021 20:22:00 GMT'
]);

Просмотреть файл

@ -82,7 +82,7 @@ export type DeleteTableEntityResponse = TableDeleteEntityHeaders;
// @public
export interface Edm<T extends EdmTypes> {
type: T;
value: T extends "Binary" ? Uint8Array : T extends "Boolean" ? boolean : T extends "Double" ? number : T extends "Int32" ? number : string;
value: T extends "Binary" ? string : T extends "Boolean" ? boolean : T extends "Double" ? number : T extends "Int32" ? number : string;
}
// @public

Просмотреть файл

@ -199,7 +199,7 @@ export interface Edm<T extends EdmTypes> {
* The value of the entity property
*/
value: T extends "Binary"
? Uint8Array
? string
: T extends "Boolean"
? boolean
: T extends "Double"

Просмотреть файл

@ -68,13 +68,11 @@ function serializeObject(obj: { value: any; type: EdmTypes }): serializedType {
obj.type === "Guid" ||
obj.type === "Int32" ||
obj.type === "Int64" ||
obj.type === "String"
obj.type === "String" ||
obj.type === "Binary"
) {
serializedValue.value = obj.value;
serializedValue.type = Edm[obj.type];
} else if (obj.type === "Binary") {
serializedValue.value = base64Encode(obj.value);
serializedValue.type = Edm.Binary;
} else {
throw new Error(`Unknown EDM type ${typeof obj.value}`);
}

Просмотреть файл

@ -119,7 +119,7 @@ describe("Serializer", () => {
const base64Encoded = "VGVzdDEyMw==";
const serialized: any = serialize({
binProp: binValue,
binObjProp: { value: binValue, type: "Binary" }
binObjProp: { value: base64Encoded, type: "Binary" }
});
assert.strictEqual(serialized.binProp, base64Encoded);
assert.strictEqual(serialized.binObjProp, base64Encoded);

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { TableClient, TableEntity, Edm, odata } from "../../src";
import { TableClient, TableEntity, Edm, odata, TableEntityResult } from "../../src";
import { Context } from "mocha";
import { assert } from "chai";
import { record, Recorder, isPlaybackMode, isLiveMode } from "@azure-tools/test-recorder";
@ -248,6 +248,76 @@ authModes.forEach((authMode) => {
assert.equal(result.testField, testEntity.testField);
});
it("should create binary entities as primitive and metadata", async () => {
const primitive = new Uint8Array([66, 97, 114]);
interface TestEntity extends TableEntity {
binary: Uint8Array;
binaryMetadata: Edm<"Binary">;
}
interface TestResult extends TableEntityResult<Record<string, unknown>> {
binary: Uint8Array;
binaryMetadata: Uint8Array;
}
const expected: TestEntity = {
partitionKey: `CreateBinary_${authMode}${suffix}`,
rowKey: `first_${authMode}${suffix}`,
binary: primitive,
binaryMetadata: {
type: "Binary",
value: "QmFy"
}
};
await client.createEntity(expected);
const result = await client.getEntity<TestResult>(expected.partitionKey, expected.rowKey);
if (isNode) {
assert.deepEqual(result.binary, Buffer.from("Bar"));
assert.deepEqual(result.binaryMetadata, Buffer.from("Bar"));
}
if (!isNode) {
assert.deepEqual(String.fromCharCode(...result.binary), "Bar");
assert.deepEqual(String.fromCharCode(...result.binaryMetadata), "Bar");
}
});
it("should create binary entities without automatic type conversion", async () => {
const primitive = new Uint8Array([66, 97, 114]);
const base64Value = "QmFy";
interface TestEntity extends TableEntity {
binary: Uint8Array;
binaryMetadata: Edm<"Binary">;
}
interface TestResult extends TableEntityResult<Record<string, unknown>> {
binary: Edm<"Binary">;
binaryMetadata: Edm<"Binary">;
}
const expected: TestEntity = {
partitionKey: `CreateBinary_${authMode}${suffix}`,
rowKey: `second_${authMode}${suffix}`,
binary: primitive,
binaryMetadata: {
type: "Binary",
value: base64Value
}
};
await client.createEntity(expected);
const result = await client.getEntity<TestResult>(expected.partitionKey, expected.rowKey, {
disableTypeConversion: true
});
assert.deepEqual(result.binary.value, base64Value);
assert.deepEqual(result.binaryMetadata.value, base64Value);
});
it("should select specific properties", async () => {
const testEntity = {
partitionKey: `P2_${suffix}`,