Skip to content

Commit

Permalink
Merge pull request #5 from pebble/standard-req-res
Browse files Browse the repository at this point in the history
Pass this.req/this.res instead of this.request/this.response
  • Loading branch information
aheckmann committed Jan 23, 2015
2 parents d60d4e0 + 6c98c3f commit 6d65738
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ module.exports.requestLogger = function (opts) {

var onResponseFinished = function () {
var responseData = {
req: this.request,
res: this.response
req: this.req,
res: this.res
};

if (err) {
Expand Down
4 changes: 2 additions & 2 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('koaBunyanLogger', function () {
assert.equal(ringBuffer.records.length, 2);
assert.ok(record(0).msg.match(REQ_MESSAGE));
assert.ok(record(1).msg.match(RES_MESSAGE));
assert.equal(record(1).res.status, status);
assert.equal(record(1).res.statusCode, status);
}

it('logs requests', function *() {
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('koaBunyanLogger', function () {
assert.ok(record(1).msg.match('clumsy'));

assert.ok(record(2).msg.match(RES_MESSAGE));
assert.equal(record(2).res.status, 200);
assert.equal(record(2).res.statusCode, 200);
});
});

Expand Down

0 comments on commit 6d65738

Please sign in to comment.