mongodb-stitch
Version:
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
69 lines • 2.42 kB
JavaScript
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;
}());
export { 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 || (HttpRequest = {}));
//# sourceMappingURL=HttpRequest.js.map