From f392c41263050e51b6a0ba1545f267e4d3e765bf Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Tue, 11 Apr 2017 17:02:15 +0200 Subject: [PATCH] implemented the 5xx range of status codes --- ts/smartstatus.classes.http.4xx.ts | 48 +++++++------ ts/smartstatus.classes.http.5xx.ts | 108 ++++++++++++++++++++++++++++- 2 files changed, 131 insertions(+), 25 deletions(-) diff --git a/ts/smartstatus.classes.http.4xx.ts b/ts/smartstatus.classes.http.4xx.ts index 66d772c..c00d006 100644 --- a/ts/smartstatus.classes.http.4xx.ts +++ b/ts/smartstatus.classes.http.4xx.ts @@ -1,6 +1,6 @@ import { HttpStatus, TStatusGroup } from './smartstatus.classes.http' -export class error400 extends HttpStatus { +export class status400 extends HttpStatus { constructor () { super({ code: 400, @@ -11,27 +11,7 @@ export class error400 extends HttpStatus { } -export class error402 extends HttpStatus { - constructor () { - super({ - code: 402, - text: 'Payment Required', - description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` - }) - } -} - -export class error403 extends HttpStatus { - constructor () { - super({ - code: 403, - text: 'Forbidden', - description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` - }) - } -} - -export class error401 extends HttpStatus { +export class status401 extends HttpStatus { constructor () { super({ code: 401, @@ -43,7 +23,29 @@ export class error401 extends HttpStatus { } -export class error404 extends HttpStatus { +export class status402 extends HttpStatus { + constructor () { + super({ + code: 402, + text: 'Payment Required', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + +export class status403 extends HttpStatus { + constructor () { + super({ + code: 403, + text: 'Forbidden', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + + + +export class status404 extends HttpStatus { constructor () { super({ code: 404, diff --git a/ts/smartstatus.classes.http.5xx.ts b/ts/smartstatus.classes.http.5xx.ts index e08b631..8bca946 100644 --- a/ts/smartstatus.classes.http.5xx.ts +++ b/ts/smartstatus.classes.http.5xx.ts @@ -4,8 +4,112 @@ export class error500 extends HttpStatus { constructor () { super({ code: 500, - text: '', - description: 'You\'ve encountered an Http error 400. That means that the page you are looking for couldn\'t be found for some reason' + text: 'Internal Server Error', + description: 'A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.' }) } } + +export class status501 extends HttpStatus { + constructor () { + super({ + code: 501, + text: 'Bad Request', + 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).` + }) + } + +} + +export class status502 extends HttpStatus { + constructor () { + super({ + code: 502, + text: 'Payment Required', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + +export class status503 extends HttpStatus { + constructor () { + super({ + code: 503, + text: 'Forbidden', + description: `The request was valid, but the server is refusing action. The user might not have the necessary permissions for a resource.` + }) + } +} + +export class status504 extends HttpStatus { + constructor () { + super({ + code: 504, + text: 'Gateway Time-out', + description: `The server was acting as a gateway or proxy + and did not receive a timely response from the upstream server.` + }) + } +} + +export class status505 extends HttpStatus { + constructor () { + super({ + code: 505, + text: 'HTTP Version Not Supported', + description: `The server does not support the HTTP protocol version used in the request.` + }) + } +} + +export class status506 extends HttpStatus { + constructor () { + super({ + code: 506, + text: 'Variant Also Negotiates', + description: `Transparent content negotiation for the request results in a circular reference.` + }) + } +} + +export class status507 extends HttpStatus { + constructor () { + super({ + code: 507, + text: 'Insufficient Storage', + description: `The server is unable to store the representation needed to complete the request.` + }) + } +} + +export class status508 extends HttpStatus { + constructor () { + super({ + code: 508, + text: 'Loop Detected', + description: `The server detected an infinite loop while processing the request` + }) + } +} + +export class status510 extends HttpStatus { + constructor () { + super({ + code: 510, + text: 'Loop Detected', + description: `The server detected an infinite loop while processing the request` + }) + } +} + +export class status511 extends HttpStatus { + constructor () { + super({ + code: 511, + text: 'Network Authentication Required', + description: `The client needs to authenticate to gain network access. + Intended for use by intercepting proxies used to control access to the network + (e.g., "captive portals" used to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot)` + }) + } +} \ No newline at end of file