Comparing version 0.4.13 to 0.4.14
'use strict'; | ||
const storageManager = require('./../StorageManager'), | ||
ResponseHeader = require('./../model/ResponseHeader'), | ||
Container = require('./../model/Container'); | ||
ResponseHeader = require('./../model/ResponseHeader'); | ||
@@ -7,0 +6,0 @@ class GetContainerMetadata { |
@@ -8,2 +8,3 @@ 'use strict'; | ||
getContainerMetadataHandler = require('./../api/GetContainerMetadata'), | ||
getContainerPropertiesHandler = require('./../api/GetContainerProperties'), | ||
env = require('./../env'); | ||
@@ -25,2 +26,4 @@ | ||
getContainerMetadataHandler.process(req, res, req.params.container); | ||
} else if (restype === 'container') { | ||
getContainerPropertiesHandler.process(req, res, req.params.container); | ||
} | ||
@@ -33,2 +36,4 @@ }) | ||
getContainerMetadataHandler.process(req, res, req.params.container); | ||
} else if (restype === 'container') { | ||
getContainerPropertiesHandler.process(req, res, req.params.container); | ||
} | ||
@@ -35,0 +40,0 @@ }) |
@@ -16,3 +16,2 @@ 'use strict'; | ||
constructor() { | ||
this.dbName = '__azurite_db__.json' | ||
} | ||
@@ -416,2 +415,16 @@ | ||
getContainerProperties(containerName) { | ||
return BbPromise.try(() => { | ||
const res = this._getCollectionAndContainer(containerName), | ||
httpProps = res.container.http_props, | ||
metaProps = res.container.meta_props; | ||
httpProps.ETag = res.container.meta.revision; | ||
httpProps['x-ms-blob-public-access'] = res.container.access; | ||
return { | ||
httpProps: httpProps, | ||
metaProps: metaProps | ||
}; | ||
}); | ||
} | ||
_getCollectionAndBlob(containerName, blobName) { | ||
@@ -418,0 +431,0 @@ const coll = this.db.getCollection(containerName); |
{ | ||
"name": "azurite", | ||
"version": "0.4.13", | ||
"version": "0.4.14", | ||
"description": "A lightweight server clone of Azure Blob Storage that simulates most of the commands supported by it with minimal dependencies.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -46,3 +46,3 @@ # Azurite | ||
## Get Container Properties | ||
## Get Container Properties [DONE] | ||
Returns all user-defined metadata and system properties of a container. | ||
@@ -49,0 +49,0 @@ |
@@ -130,3 +130,61 @@ const chai = require('chai'), | ||
}); | ||
describe('Container System Properties', () => { | ||
it('should update an existing container with metadata.', () => { | ||
return chai.request(url) | ||
.put(`${urlPath}/${propContainer}`) | ||
.query({ restype: 'container', comp: 'metadata' }) | ||
.set('x-ms-meta-test1', 'value1') | ||
.set('x-ms-meta-test2', 'value2') | ||
.set('x-ms-meta-meta1', 'meta1Value') | ||
.then((res) => { | ||
res.should.have.status(200); | ||
}); | ||
}); | ||
it('should get the correct metadata. (GET)', () => { | ||
return chai.request(url) | ||
.get(`${urlPath}/${propContainer}`) | ||
.query({ restype: 'container' }) | ||
.then((res) => { | ||
res.should.have.status(200); | ||
res.should.have.header('x-ms-meta-test1', 'value1'); | ||
res.should.have.header('x-ms-meta-test2', 'value2'); | ||
res.should.have.header('x-ms-meta-meta1', 'meta1Value'); | ||
res.should.have.header('Last-Modified'); | ||
res.should.have.header('ETag'); | ||
res.should.have.header('x-ms-blob-public-access'); | ||
}); | ||
}); | ||
it('should get the correct metadata. (HEAD)', () => { | ||
return chai.request(url) | ||
.head(`${urlPath}/${propContainer}`) | ||
.query({ restype: 'container' }) | ||
.then((res) => { | ||
res.should.have.status(200); | ||
res.should.have.header('x-ms-meta-test1', 'value1'); | ||
res.should.have.header('x-ms-meta-test2', 'value2'); | ||
res.should.have.header('x-ms-meta-meta1', 'meta1Value'); | ||
res.should.have.header('Last-Modified'); | ||
res.should.have.header('ETag'); | ||
res.should.have.header('x-ms-blob-public-access'); | ||
}); | ||
}); | ||
it('should fail to get metadata of a non-existant container (GET)', () => { | ||
return chai.request(url) | ||
.get(`${urlPath}/CONTAINER_DOESNOTEXIST`) | ||
.query({ restype: 'container' }) | ||
.catch((e) => { | ||
e.should.have.status(404); | ||
}); | ||
}); | ||
it('should fail to get metadata of a non-existant container (HEAD)', () => { | ||
return chai.request(url) | ||
.head(`${urlPath}/CONTAINER_DOESNOTEXIST`) | ||
.query({ restype: 'container' }) | ||
.catch((e) => { | ||
e.should.have.status(404); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83555
41
1851