Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MANTA-4341 Optimize conditional object operations #382

Merged
merged 14 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/buckets.js
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,13 @@ function headBucketObject(bucketName, objectName, opts, cb) {
}

res.once('end', function onEnd() {
cb(null, res);
/*
* XXX Need to include `resErr` here because in the case of
* a HEAD request that fails precondition checks, it looks
* like we're currently also getting `res`. I don't know if
* that's normal or not.
*/
cb(resErr, res);
});

res.resume();
Expand Down
11 changes: 11 additions & 0 deletions test/integration/buckets-client-basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ test('buckets client basic', testOpts, function (suite) {
});
});

test('headBucketObject (not found)', function (t) {
clientMethodsToTest.delete('headBucketObject');
client.headBucketObject(BUCKET_NAME, OBJECT_NAME + '-not-found',
function (err, res) {
t.ok(err);
t.ok(res);
t.ok(res.statusCode, 404);
t.end();
});
});

test('getBucketObject', function (t) {
clientMethodsToTest.delete('getBucketObject');
client.getBucketObject(BUCKET_NAME, OBJECT_NAME,
Expand Down
Loading