mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

* feat: redirect handler Signed-off-by: Wouter Termont <woutermont@gmail.com> * chore: rewrite reduction as loop Signed-off-by: Wouter Termont <woutermont@gmail.com> * chore: remove example import Signed-off-by: Wouter Termont <woutermont@gmail.com> * feat: add more redirect flavours Signed-off-by: Wouter Termont <woutermont@gmail.com> * chore: RedirectingHttpHandler with RedirectAllHttpHandler Signed-off-by: Wouter Termont <woutermont@gmail.com> * chore: replace RedirectAllHttpHandler with RedirectingHttpHandler * chore: revert 5956385 (chore: replace RedirectAllHttpHandler with RedirectingHttpHandler) This reverts commit 5956385c4180e8e8914b9199c4ed6ca8ae7d39fb. * docs: complete constructor params Signed-off-by: Wouter Termont <woutermont@gmail.com>
18 lines
693 B
TypeScript
18 lines
693 B
TypeScript
import type { HttpErrorOptions } from './HttpError';
|
|
import { RedirectHttpError } from './RedirectHttpError';
|
|
|
|
/**
|
|
* Error used to redirect not to the requested resource itself, but to another page,
|
|
* for example a representation of a real-world object.
|
|
* The method used to display this redirected page is always GET.
|
|
*/
|
|
export class SeeOtherHttpError extends RedirectHttpError {
|
|
public constructor(location: string, message?: string, options?: HttpErrorOptions) {
|
|
super(303, location, 'SeeOtherHttpError', message, options);
|
|
}
|
|
|
|
public static isInstance(error: any): error is SeeOtherHttpError {
|
|
return RedirectHttpError.isInstance(error) && error.statusCode === 303;
|
|
}
|
|
}
|