From 93556929d8a7971cff6abd4064a5c00fa43a42ce Mon Sep 17 00:00:00 2001 From: Joey van Dijk Date: Mon, 17 Dec 2012 09:28:40 +0100 Subject: [PATCH] added support for versioning on S3 enabled support for unrequired resource-variables like versioning (on S3). --- lib/amazon/s3-config.js | 5 +++++ lib/awssum.js | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/amazon/s3-config.js b/lib/amazon/s3-config.js index 0629c512..0db352f1 100644 --- a/lib/amazon/s3-config.js +++ b/lib/amazon/s3-config.js @@ -521,6 +521,11 @@ module.exports = { required : true, type : 'special', }, + Versions : { + name : 'versions', + required : false, + type : 'resource', + }, Delimiter : { name : 'delimiter', required : false, diff --git a/lib/awssum.js b/lib/awssum.js index 61ee0824..e843b556 100644 --- a/lib/awssum.js +++ b/lib/awssum.js @@ -497,8 +497,10 @@ AwsSum.prototype.send = function(operation, args, opts, callback) { addParamIfDefined( options.params, name, args[argName] ); } else if ( spec.type === 'resource' ) { - // for Amazon S3 .. things like /?acl, /?policy and /?logging - addParam( options.params, name, undefined ); + // for Amazon S3 .. things like /?acl, /?policy, /?versions and /?logging + if(spec.required || (!spec.required && args[argName].toString() === "true")){ + addParam( options.params, name, undefined); + } } else if ( spec.type === 'param-array' ) { addParamArray( options.params, name, args[argName], spec.prefix );