diff --git a/README.md b/README.md index 6d8e334..27972b6 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,27 @@ signer.sign(opts); Parse.Cloud.httpRequest(opts); ``` +or + +```js +var AwsSign = require('cloud/modules/aws-sign.js'); +var signer = new AwsSign({ + accessKeyId: 'AKIAIOSFODNN7EXAMPLE', + secretAccessKey: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' +}); + +Parse.Cloud.httpRequest(signer.sign({ + method: 'PUT', + url: 'http://johnsmith.s3.amazonaws.com/photos/puppy.jpg', + headers: { ... }, + ... // Other request options, ignored by AwsSign. + body: {} + success: function() {}, + error: function() {} +})); +``` + + The following keys are mandatory: * `method` diff --git a/aws-sign.js b/aws-sign.js index f9760f6..902ea7a 100644 --- a/aws-sign.js +++ b/aws-sign.js @@ -110,6 +110,8 @@ AWSRestSigner.prototype.sign = function(opts) { } opts.headers["Authorization"] = this._sign(method, bucket, path, date, contentType, contentMd5, xAmzHeaders); + + return opts; }