import { HttpStatusCodes } from '../Server' ; import { Response } from './Response' ; export class RedirectionResponse extends Response { public static create ( statusCode , location , alt ? , meta ? ) { return new this ( { statusCode , data : { location , alt } , meta } ) ; } public static multipleChoices ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . MultipleChoices , location , alt , meta ) ; } public static movedPermanently ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . MovedPermanently , location , alt , meta ) ; } public static found ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . Found , location , alt , meta ) ; } public static seeOther ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . SeeOther , location , alt , meta ) ; } public static notModified ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . NotModified , location , alt , meta ) ; } public static useProxy ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . UseProxy , location , alt , meta ) ; } public static switchProxy ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . SwitchProxy , location , alt , meta ) ; } public static temporaryRedirect ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . TemporaryRedirect , location , alt , meta ) ; } public static permanentRedirect ( location , alt ? , meta ? ) { return this . create ( HttpStatusCodes . PermanentRedirect , location , alt , meta ) ; } apply ( ) { this . ctx . redirect ( this . data . location , this . data . alt ) ; } }