expressjs/session — pull request #75 by trevorah (2014-08-18 13:14:42+00:00)
Title: fixed head requests throwing errors for express 3.x

In express 3.x, any HEAD request that uses express-session will throw a 500 error.

This is because `express/lib/response.js` calls `this.end(null, encoding)` if the request is a HEAD request ([see closest blame here](https://github.com/strongloop/express/commit/f14e39d4515c81c1e5c980b7ce31566eeeb84734#diff-d86a59ede7d999db4b7bc43cb25a1c11L155)).

As the HEAD request just gets the headers for a particular resource, then the content length can also be set. This unfortunately means that the `res.end` patch attempts to create a `new Buffer(null)` which throws (usually when `node/lib/buffer.js` getting the length property of null).

This PR fixes it, with an extra test for `res.end(undefined)` just to be sure.