UNPKG

@iredium/butterfly

Version:
38 lines (37 loc) 1.3 kB
"use strict"; var __spreadArrays = (this && this.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; Object.defineProperty(exports, "__esModule", { value: true }); var BaseResponse = /** @class */ (function () { function BaseResponse() { this.statusCode = 200; this.cookieArgs = []; } BaseResponse.prototype.status = function (status) { this.statusCode = status; return this; }; BaseResponse.prototype.cookie = function (name) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } this.cookieArgs.push(__spreadArrays([name], args)); return this; }; BaseResponse.prototype.executeRender = function (res) { res.status(this.statusCode); for (var _i = 0, _a = this.cookieArgs; _i < _a.length; _i++) { var cookieArg = _a[_i]; res.cookie.apply(res, cookieArg); } this.render(res); }; return BaseResponse; }()); exports.BaseResponse = BaseResponse;