Comparing version 0.4.2-r4 to 0.4.2-r5
@@ -167,3 +167,3 @@ /** | ||
} | ||
return this.requestController.responseManager; | ||
return this.requestController.requestManager.responseManager; | ||
} | ||
@@ -170,0 +170,0 @@ ); |
@@ -53,6 +53,19 @@ /** | ||
} | ||
return this.requestController.responseManagers['application/json']; | ||
return this.requestController.requestManager.responseManagers['application/json']; | ||
} | ||
); | ||
/** | ||
* Runs the controller. | ||
* | ||
* Writes directly to the given response object. | ||
* | ||
* @param http.ServerResponse resp Server response Object. Write your data into | ||
* this object directly. | ||
*/ | ||
module.exports.prototype.run = function(resp) { | ||
VC.instance_of(resp, 'resp', http.ServerResponse); | ||
this[this.request.method.toLowerCase()](resp); | ||
}; | ||
module.exports.prototype.options = function(resp) { | ||
@@ -86,13 +99,4 @@ this.responseManager.writeMethodNotAllowed(resp, 'options'); | ||
/** | ||
* Runs the controller. | ||
* | ||
* Writes directly to the given response object. | ||
* | ||
* @param http.ServerResponse resp Server response Object. Write your data into | ||
* this object directly. | ||
*/ | ||
module.exports.prototype.run = function(resp) { | ||
VC.instance_of(resp, 'resp', http.ServerResponse); | ||
this[this.request.method](resp); | ||
module.exports.prototype.put = function(resp) { | ||
this.responseManager.writeMethodNotAllowed(resp, 'put'); | ||
}; |
@@ -79,3 +79,3 @@ /** | ||
this.responseManagers = respManagers; | ||
this._responseManagers = respManagers; | ||
this._getDefaultRespManCb = getDefaultRespManCb; | ||
@@ -82,0 +82,0 @@ |
{ | ||
"name": "mvcfun", | ||
"version": "0.4.2r4", | ||
"version": "0.4.2r5", | ||
"description": "MVC based web server framework", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,6 +35,21 @@ /** | ||
var methods = mvcfun.http.Server.METHODS; | ||
for (var i = 0; i < methods; ++i) { | ||
for (var i = 0; i < methods.length; ++i) { | ||
it('should return method not allowed [' + methods[i] + ']', | ||
(function(method) { | ||
return function(done) { | ||
var httpresp = new http.ServerResponse( | ||
{method: method} | ||
); | ||
httpresp.end = function(content) { | ||
this.should.have.status(405); | ||
done(); | ||
} | ||
var ctrl = new mvcfun.controller.Rest( | ||
'/filename' | ||
); | ||
reqCtrl.addController(ctrl); | ||
reqMan._requestData = { | ||
method: method | ||
}; | ||
reqCtrl.run(httpresp, ctrl); | ||
} | ||
@@ -45,3 +60,2 @@ })(methods[i]) | ||
}); | ||
}); |
@@ -124,3 +124,3 @@ /** | ||
method: method | ||
} | ||
}; | ||
reqCtrl.run(resp, ctrl); | ||
@@ -127,0 +127,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
165268
4646