node-web-mvc
Version:
node spring mvc
31 lines (30 loc) • 983 B
JavaScript
;
/**
* @module ResponseEntity
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const HttpStatus_1 = __importDefault(require("../http/HttpStatus"));
const HttpEntity_1 = __importDefault(require("./HttpEntity"));
class ResponseEntity extends HttpEntity_1.default {
static status(status) {
return new ResponseEntity(status);
}
static ok() {
return new ResponseEntity(HttpStatus_1.default.OK);
}
constructor(data, headers, status) {
super(data instanceof HttpStatus_1.default ? null : data, headers);
if (data instanceof HttpStatus_1.default) {
this.body = null;
this.responseStatus = data;
}
else {
this.body = data;
this.responseStatus = status;
}
}
}
exports.default = ResponseEntity;