smartstatus/ts/smartstatus.classes.http.4xx.ts

74 lines
2.7 KiB
TypeScript
Raw Normal View History

2019-01-02 00:00:53 +00:00
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
2017-04-06 15:00:38 +00:00
2019-01-02 01:08:12 +00:00
export class Status400 extends HttpStatus {
2019-01-02 00:00:53 +00:00
constructor() {
super({
code: 400,
text: 'Bad Request',
2021-08-16 13:36:41 +00:00
description: `The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).`,
2019-01-02 00:00:53 +00:00
});
2017-04-06 15:00:38 +00:00
}
}
2019-01-02 01:08:12 +00:00
HttpStatus.addStatus('400', Status400);
2017-04-06 15:00:38 +00:00
2019-01-02 01:08:12 +00:00
// tslint:disable-next-line: max-classes-per-file
export class Status401 extends HttpStatus {
2019-01-02 00:00:53 +00:00
constructor() {
super({
code: 401,
text: 'Unauthorized',
description: `Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the requested resource. See Basic access authentication and Digest access authentication.[32] 401 semantically means "unauthenticated",[33] i.e. the user does not have the necessary credentials.
2021-08-16 13:36:41 +00:00
Note: Some sites issue HTTP 401 when an IP address is banned from the website (usually the website domain) and that specific address is refused permission to access a website.`,
2019-01-02 00:00:53 +00:00
});
}
}
2019-01-02 01:08:12 +00:00
HttpStatus.addStatus('401', Status401);
2019-01-02 01:08:12 +00:00
// tslint:disable-next-line: max-classes-per-file
export class Status402 extends HttpStatus {
2019-01-02 00:00:53 +00:00
constructor() {
super({
code: 402,
text: 'Payment Required',
2021-08-16 13:36:41 +00:00
description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.`,
2019-01-02 00:00:53 +00:00
});
2017-04-06 15:00:38 +00:00
}
}
2019-01-02 01:08:12 +00:00
HttpStatus.addStatus('402', Status402);
2017-04-06 15:00:38 +00:00
2019-01-02 01:08:12 +00:00
// tslint:disable-next-line: max-classes-per-file
export class Status403 extends HttpStatus {
2019-01-02 00:00:53 +00:00
constructor() {
super({
code: 403,
text: 'Forbidden',
2021-08-16 13:36:41 +00:00
description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.`,
2019-01-02 00:00:53 +00:00
});
2017-04-06 15:00:38 +00:00
}
}
2019-01-02 01:08:12 +00:00
HttpStatus.addStatus('403', Status403);
2017-04-06 15:00:38 +00:00
2019-01-02 01:08:12 +00:00
// tslint:disable-next-line: max-classes-per-file
export class Status404 extends HttpStatus {
2019-01-02 00:00:53 +00:00
constructor() {
super({
code: 404,
text: 'Not Found',
2021-08-16 13:36:41 +00:00
description: `The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.`,
2019-01-02 00:00:53 +00:00
});
2017-04-06 15:00:38 +00:00
}
}
2019-01-02 01:08:12 +00:00
HttpStatus.addStatus('404', Status404);
// tslint:disable-next-line: max-classes-per-file
export class Status429 extends HttpStatus {
constructor() {
super({
2019-01-02 17:44:47 +00:00
code: 429,
2019-01-02 01:08:12 +00:00
text: 'Too Many Requests',
2021-08-16 13:36:41 +00:00
description: `The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.`,
2019-01-02 01:08:12 +00:00
});
}
}
HttpStatus.addStatus('429', Status429);