UNPKG

1.8 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const Server_1 = require("../Server");
4const Response_1 = require("./Response");
5class RedirectionResponse extends Response_1.Response {
6 static create(statusCode, location, alt, meta) {
7 return new this({ statusCode, data: { location, alt }, meta });
8 }
9 static multipleChoices(location, alt, meta) {
10 return this.create(Server_1.HttpStatusCodes.MultipleChoices, location, alt, meta);
11 }
12 static movedPermanently(location, alt, meta) {
13 return this.create(Server_1.HttpStatusCodes.MovedPermanently, location, alt, meta);
14 }
15 static found(location, alt, meta) {
16 return this.create(Server_1.HttpStatusCodes.Found, location, alt, meta);
17 }
18 static seeOther(location, alt, meta) {
19 return this.create(Server_1.HttpStatusCodes.SeeOther, location, alt, meta);
20 }
21 static notModified(location, alt, meta) {
22 return this.create(Server_1.HttpStatusCodes.NotModified, location, alt, meta);
23 }
24 static useProxy(location, alt, meta) {
25 return this.create(Server_1.HttpStatusCodes.UseProxy, location, alt, meta);
26 }
27 static switchProxy(location, alt, meta) {
28 return this.create(Server_1.HttpStatusCodes.SwitchProxy, location, alt, meta);
29 }
30 static temporaryRedirect(location, alt, meta) {
31 return this.create(Server_1.HttpStatusCodes.TemporaryRedirect, location, alt, meta);
32 }
33 static permanentRedirect(location, alt, meta) {
34 return this.create(Server_1.HttpStatusCodes.PermanentRedirect, location, alt, meta);
35 }
36 apply() {
37 this.ctx.redirect(this.data.location, this.data.alt);
38 }
39}
40exports.RedirectionResponse = RedirectionResponse;
41//# sourceMappingURL=RedirectionResponse.js.map
\No newline at end of file