This repository has been archived on 2020-08-13. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-14 14:56:08 +02:00

51 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var consts_1 = require("@scode/consts");
var Status = /** @class */ (function () {
function Status() {
this._status = -1;
}
Object.defineProperty(Status.prototype, "status", {
get: function () {
if (this._status === -1)
throw new Error('status undefined');
return this._status;
},
set: function (value) {
this._status = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Status.prototype, "has_status", {
get: function () {
return this._status !== -1;
},
enumerable: true,
configurable: true
});
/*
* Status setters
*/
Status.prototype.ok = function () {
this._status = consts_1.http.status_ok;
};
Status.prototype.ok_no_content = function () {
this._status = consts_1.http.status_ok_no_content;
};
Status.prototype.bad_request = function () {
this._status = consts_1.http.status_bad_request;
};
Status.prototype.unauthorized = function () {
this._status = consts_1.http.status_unauthorized;
};
Status.prototype.forbidden = function () {
this._status = consts_1.http.status_forbidden;
};
Status.prototype.not_found = function () {
this._status = consts_1.http.status_not_found;
};
return Status;
}());
exports.default = Status;