Skip to content

Commit c28f8cc

Browse files
authored
Merge pull request #187 from jamhall/fix-listobjects-istruncated
Include correct IsTruncated value in listObjects response
2 parents bc79afb + d0b74a8 commit c28f8cc

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Diff for: lib/xml-template-builder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ exports.buildBucketQuery = function(bucketName, options, data) {
3535
_attrs: { xmlns: "http://doc.s3.amazonaws.com/2006-03-01" },
3636
_content: [
3737
{
38-
IsTruncated: options.isTruncated || false,
38+
IsTruncated: data.isTruncated || false,
3939
Marker: options.marker || "",
4040
Name: bucketName,
4141
Prefix: options.prefix || "",

Diff for: test/test.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ describe("S3rver Tests", function() {
727727
const data = yield s3Client.listObjects({ Bucket: buckets[1] }).promise();
728728
expect(data.Name).to.equal(buckets[1]);
729729
expect(data.Contents).to.have.lengthOf(testObjects.length);
730+
expect(data.IsTruncated).to.be.false;
730731
});
731732

732733
it("should list objects in a bucket filtered by a prefix", function*() {
@@ -913,18 +914,18 @@ describe("S3rver Tests", function() {
913914

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

922922
it("should return 500 small objects", function*() {
923923
yield generateTestObjects(s3Client, buckets[2], 1000);
924-
const objects = yield s3Client
924+
const data = yield s3Client
925925
.listObjects({ Bucket: buckets[2], MaxKeys: 500 })
926926
.promise();
927-
expect(objects.Contents).to.have.lengthOf(500);
927+
expect(data.IsTruncated).to.be.true;
928+
expect(data.Contents).to.have.lengthOf(500);
928929
});
929930

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

0 commit comments

Comments
 (0)