mongodb-stitch
Version:
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
82 lines • 3.21 kB
JavaScript
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var HttpRequest = (function () {
function HttpRequest(url, method, authUrl, headers, cookies, body, encodeBodyAsJson, form, followRedirects) {
this.url = url;
this.method = method;
this.authUrl = authUrl;
this.headers = headers;
this.cookies = cookies;
this.body = body;
this.encodeBodyAsJson = encodeBodyAsJson;
this.form = form;
this.followRedirects = followRedirects;
}
return HttpRequest;
}());
exports.HttpRequest = HttpRequest;
(function (HttpRequest) {
var Builder = (function () {
function Builder() {
}
Builder.prototype.withUrl = function (url) {
this.url = url;
return this;
};
Builder.prototype.withMethod = function (method) {
this.method = method;
return this;
};
Builder.prototype.withAuthUrl = function (authUrl) {
this.authUrl = authUrl;
return this;
};
Builder.prototype.withHeaders = function (headers) {
this.headers = headers;
return this;
};
Builder.prototype.withCookies = function (cookies) {
this.cookies = cookies;
return this;
};
Builder.prototype.withBody = function (body) {
this.body = body;
return this;
};
Builder.prototype.withEncodeBodyAsJson = function (encodeBodyAsJson) {
this.encodeBodyAsJson = encodeBodyAsJson;
return this;
};
Builder.prototype.withForm = function (form) {
this.form = form;
return this;
};
Builder.prototype.withFollowRedirects = function (followRedirects) {
this.followRedirects = followRedirects;
return this;
};
Builder.prototype.build = function () {
if (this.url == null || this.url === "") {
throw new Error("must set url");
}
if (this.method == null) {
throw new Error("must set method");
}
return new HttpRequest(this.url, this.method, this.authUrl, this.headers, this.cookies, this.body, this.encodeBodyAsJson, this.form, this.followRedirects);
};
return Builder;
}());
HttpRequest.Builder = Builder;
})(HttpRequest = exports.HttpRequest || (exports.HttpRequest = {}));
exports.HttpRequest = HttpRequest;
});
//# sourceMappingURL=HttpRequest.js.map