Skip to content

Commit

Permalink
Fix request._route override. Closes #1137
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Nov 11, 2013
1 parent e9faef7 commit 5cbe821
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ exports = module.exports = internals.Request = function (server, req, res, optio
// Private members

this._timestamp = now;
this._route = null;
this._states = {}; // Appended to response states when setting response headers
this._logger = [];

Expand Down
23 changes: 23 additions & 0 deletions test/integration/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ describe('Ext', function () {
done();
});
});

it('replies with a view', function (done) {

var server = new Hapi.Server({
views: {
engines: { 'html': 'handlebars' },
path: __dirname + '/../unit/templates/valid'
}
});

server.ext('onRequest', function (request, next) {

return next(request.generateView('test', { message: 'hola!' }));
});

server.route({ method: 'GET', path: '/', handler: function () { this.reply('ok'); } });

server.inject({ method: 'GET', url: '/' }, function (res) {

expect(res.result).to.equal('<div>\n <h1>hola!</h1>\n</div>\n');
done();
});
});
});

describe('#onPreResponse', function (done) {
Expand Down

0 comments on commit 5cbe821

Please sign in to comment.