Skip to content

Commit

Permalink
fix(listObjects): Include correct IsTruncated value in response
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Mar 15, 2018
1 parent 1e152e2 commit d0b74a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/xml-template-builder.js
Expand Up @@ -35,7 +35,7 @@ exports.buildBucketQuery = function(options, data) {
_attrs: { xmlns: "http://doc.s3.amazonaws.com/2006-03-01" },
_content: [
{
IsTruncated: options.isTruncated || false,
IsTruncated: data.isTruncated || false,
Marker: options.marker || "",
Name: options.bucketName,
Prefix: options.prefix || "",
Expand Down
13 changes: 7 additions & 6 deletions test/test.js
Expand Up @@ -726,6 +726,7 @@ describe("S3rver Tests", function() {
);
const data = yield s3Client.listObjects({ Bucket: buckets[1] }).promise();
expect(data.Contents).to.have.lengthOf(testObjects.length);
expect(data.IsTruncated).to.be.false;
});

it("should list objects in a bucket filtered by a prefix", function*() {
Expand Down Expand Up @@ -912,18 +913,18 @@ describe("S3rver Tests", function() {

it("should return one thousand small objects", function*() {
yield generateTestObjects(s3Client, buckets[2], 2000);
const objects = yield s3Client
.listObjects({ Bucket: buckets[2] })
.promise();
expect(objects.Contents).to.have.lengthOf(1000);
const data = yield s3Client.listObjects({ Bucket: buckets[2] }).promise();
expect(data.IsTruncated).to.be.true;
expect(data.Contents).to.have.lengthOf(1000);
});

it("should return 500 small objects", function*() {
yield generateTestObjects(s3Client, buckets[2], 1000);
const objects = yield s3Client
const data = yield s3Client
.listObjects({ Bucket: buckets[2], MaxKeys: 500 })
.promise();
expect(objects.Contents).to.have.lengthOf(500);
expect(data.IsTruncated).to.be.true;
expect(data.Contents).to.have.lengthOf(500);
});

it("should delete 500 small objects", function*() {
Expand Down

0 comments on commit d0b74a8

Please sign in to comment.