visionmedia/supertest — pull request #86 by bajtos (2013-11-29 14:46:15+00:00)
Title: Pass `this` to end() callbacks

The change allows developer to access the `Test` object and its properties like `url` from the callback passed to `.end()`. This is useful when the request URL is constructed dynamically using a random server port.

Example:

request(app)
.get('/foo/bar')
.end(function(err, res) {
if (err) return done(err);
var remoteOrigin = url.resolve(this.url, '/');
res.body.originUrl.should.eql(remoteOrigin);
});