routing-controllers
Version:
Create structured, declarative and beautifully organized class-based controllers with heavy decorators usage for Express / Koa using TypeScript.
21 lines • 719 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpCode = HttpCode;
const index_1 = require("../index");
/**
* Sets response HTTP status code.
* Http code will be set only when controller action is successful.
* In the case if controller action rejects or throws an exception http code won't be applied.
* Must be applied on a controller action.
*/
function HttpCode(code) {
return function (object, methodName) {
(0, index_1.getMetadataArgsStorage)().responseHandlers.push({
type: 'success-code',
target: object.constructor,
method: methodName,
value: code,
});
};
}
//# sourceMappingURL=HttpCode.js.map
;