egorFiNE/node-aws-sign — pull request #3 by btrask (2012-10-10 16:56:32+00:00)
Title: More changes, this time with tests

Thanks for accepting my last pull request.

This time I fixed a bug where the date header was not being set. This meant that any user who was relying on the documented ability to not specify a date would have problems.

I also refactored the way tests are run. This let me remove the return result from the `sign()` function, which I think is important for preventing confusion.

That said, arguably `sign()` should return the original `opts` object, so you could call it like this:

```javascript
https.request(signer.sign(opts)); // inline
```

However, I think that if you want to do that, the original `opts` object should be copied and the original should be unmodified:

```javascript
var opts = {...};
var signedOpts = signer.sign(opts);
test.notEqual(signedOpts, opts); // opts is unchanged
```

That change is not included in this patch, because I'm not sure it's necessary. It would require deep-copying the `opts` object.