Skip to content

Commit 9bfc944

Browse files
committed
Add optional settings argument to Controller.
Controller extensions broke in 1d46eae because the settings arguments was not passed.
1 parent fdfcb54 commit 9bfc944

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/controllers/Controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Controller.extend = function extend(child) {
3030
};
3131

3232
// Tries to process the HTTP request
33-
Controller.prototype.handleRequest = function (request, response, next) {
33+
Controller.prototype.handleRequest = function (request, response, next, settings) {
3434
// Add a `parsedUrl` field to `request`,
3535
// containing the parsed request URL, resolved against the base URL
3636
if (!request.parsedUrl) {
@@ -41,7 +41,7 @@ Controller.prototype.handleRequest = function (request, response, next) {
4141

4242
// Try to handle the request
4343
var self = this;
44-
try { this._handleRequest(request, response, done); }
44+
try { this._handleRequest(request, response, done, settings); }
4545
catch (error) { done(error); }
4646
function done(error) {
4747
if (self) {
@@ -55,7 +55,7 @@ Controller.prototype.handleRequest = function (request, response, next) {
5555
};
5656

5757
// Tries to process the HTTP request in an implementation-specific way
58-
Controller.prototype._handleRequest = function (request, response, next) {
58+
Controller.prototype._handleRequest = function (request, response, next, settings) {
5959
next();
6060
};
6161

test/controllers/Controller-test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ describe('Controller', function () {
3636
it('should call _handleRequest with request, response and next', function () {
3737
controller._handleRequest.should.have.been.calledOnce;
3838
var args = controller._handleRequest.getCall(0).args;
39-
args.should.have.length(3);
4039
args[0].should.have.property('url');
4140
args[1].should.be.an.instanceof(http.ServerResponse);
4241
args[2].should.be.an.instanceof(Function);
@@ -75,7 +74,6 @@ describe('Controller', function () {
7574
it('should call _handleRequest with request, response and next', function () {
7675
controller._handleRequest.should.have.been.calledOnce;
7776
var args = controller._handleRequest.getCall(0).args;
78-
args.should.have.length(3);
7977
args[0].should.have.property('url');
8078
args[1].should.be.an.instanceof(http.ServerResponse);
8179
args[2].should.be.an.instanceof(Function);

0 commit comments

Comments
 (0)