UNPKG

mnubo-sdk

Version:
37 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var underscore_1 = require("../utils/underscore"); var RequestMethods; (function (RequestMethods) { RequestMethods[RequestMethods["GET"] = 0] = "GET"; RequestMethods[RequestMethods["POST"] = 1] = "POST"; RequestMethods[RequestMethods["PUT"] = 2] = "PUT"; RequestMethods[RequestMethods["DELETE"] = 3] = "DELETE"; RequestMethods[RequestMethods["OPTIONS"] = 4] = "OPTIONS"; RequestMethods[RequestMethods["HEAD"] = 5] = "HEAD"; RequestMethods[RequestMethods["PATCH"] = 6] = "PATCH"; })(RequestMethods = exports.RequestMethods || (exports.RequestMethods = {})); var Request = /** @class */ (function () { function Request(method, options, body) { this.method = method; this.options = options; this.body = body; } Request.prototype.hasPayload = function () { return underscore_1.isPresent(this.body); }; Request.prototype.payload = function () { if (!this.hasPayload()) { return ''; } if (typeof this.body !== 'string') { return JSON.stringify(this.body); } else { return this.body; } }; return Request; }()); exports.Request = Request; //# sourceMappingURL=request.js.map