appsattic/node-awssum — pull request #13 by nfriedly (2012-04-06 02:41:39+00:00)
Title: Fixed two bugs I added, an addExtras enhancement, updated example

The primary reason for this is to fix the two bugs I introduced with my previous pull request:

* AwsSum.prototype.request once again properly handles errors on sending the request out
* It also once again accepts Buffers for the body. (This is useful for binary data.)

I didn't like how the only extra on `S3.PubObject` was the MD5 one which in turn called the content-length one. So I changed it to be an array containing both functions. Then I realized that it didn't matter because content-length was a required header so it would always go with the user-supplied one or else throw an error. But `S3.PutBucket` also needed both an MD5 and a Content-Length so I kept the changes.

I also changed `extrasContentLength` to use `Buffer.byteLength()` because both `string.length` and `buffer.length` can lead to incorrect content-length headers. It still won't work for non-string bodies, but it looks like it won't ever be called with a non-string body currently.

Lastly, I updated the s3 put-object example to use `Buffer.byteLength()` rather than have the content-length hard-coded and also commented to check the s3-streaming example for an example with a file.

So, in short, two bug fixes and a lot of junk :P