Comparing version 0.0.1-55 to 0.0.1-56
import { ActionResult } from "../core"; | ||
export declare namespace InvocationResult { | ||
function create(result: any): Promise<ActionResult>; | ||
function create(result: any, status?: number, type?: string): Promise<ActionResult>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var api_action_result_1 = require("../controller/api-action-result"); | ||
var Core = require("../core"); | ||
var ControllerExecutor = (function () { | ||
@@ -21,3 +21,3 @@ function ControllerExecutor(factory, request) { | ||
result = method.apply(controller, parameters); | ||
return [2 /*return*/, new api_action_result_1.ApiActionResult(controller.validator.getValidationErrors(), 400)]; | ||
return [2 /*return*/, new Core.ActionResult(controller.validator.getValidationErrors(), 400, "application/json")]; | ||
} | ||
@@ -24,0 +24,0 @@ return [2 /*return*/, method.apply(controller, parameters)]; |
@@ -30,3 +30,5 @@ "use strict"; | ||
result = this.executor.execute(this.parameters); | ||
return [2 /*return*/, invocation_result_1.InvocationResult.create(result)]; | ||
if (this.controllerInfo.classMetaData.baseClass == "ApiController") | ||
return [2 /*return*/, invocation_result_1.InvocationResult.create(result, 200, "application/json")]; | ||
return [2 /*return*/, invocation_result_1.InvocationResult.create(result, 200, "text/html")]; | ||
}); | ||
@@ -33,0 +35,0 @@ }); |
@@ -5,6 +5,5 @@ "use strict"; | ||
var core_1 = require("../core"); | ||
var controller_1 = require("../controller"); | ||
var InvocationResult; | ||
(function (InvocationResult) { | ||
function create(result) { | ||
function create(result, status, type) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
@@ -19,3 +18,3 @@ var awaitedResult; | ||
return [2 /*return*/, awaitedResult]; | ||
return [2 /*return*/, new controller_1.ApiActionResult(awaitedResult)]; | ||
return [2 /*return*/, new core_1.ActionResult(awaitedResult, status, type)]; | ||
} | ||
@@ -22,0 +21,0 @@ }); |
{ | ||
"name": "kamboja", | ||
"version": "0.0.1-55", | ||
"version": "0.0.1-56", | ||
"description": "MVC Framework powered by TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "lib/source/index.js", |
156557
3662