fix(core): update
This commit is contained in:
@ -1,7 +1 @@
|
||||
export { HttpStatus } from './smartstatus.classes.http'
|
||||
|
||||
export * from './smartstatus.classes.http.1xx'
|
||||
export * from './smartstatus.classes.http.2xx'
|
||||
export * from './smartstatus.classes.http.3xx'
|
||||
export * from './smartstatus.classes.http.4xx'
|
||||
export * from './smartstatus.classes.http.5xx'
|
||||
export * from './smartstatus.classes.http';
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http'
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
|
||||
|
||||
export class status100 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 100,
|
||||
text: 'Continue',
|
||||
description: `The server has received the request headers and the client
|
||||
constructor() {
|
||||
super({
|
||||
code: 100,
|
||||
text: 'Continue',
|
||||
description: `The server has received the request headers and the client
|
||||
should proceed to send the request body
|
||||
(in the case of a request for which a body needs to be sent; for example, a POST request).
|
||||
Sending a large request body to a server after a request has been rejected
|
||||
@ -14,30 +14,30 @@ export class status100 extends HttpStatus {
|
||||
a client must send Expect: 100-continue as a header in its initial request and receive
|
||||
a 100 Continue status code in response before sending the body.
|
||||
The response 417 Expectation Failed indicates the request should not be continued.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status101 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 101,
|
||||
text: 'Switching Protocols',
|
||||
description: `The requester has asked the server to switch protocols and the server has agreed to do so.`
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 101,
|
||||
text: 'Switching Protocols',
|
||||
description: `The requester has asked the server to switch protocols and the server has agreed to do so.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status102 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 102,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `A WebDAV request may contain many sub-requests involving file operations,
|
||||
constructor() {
|
||||
super({
|
||||
code: 102,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `A WebDAV request may contain many sub-requests involving file operations,
|
||||
requiring a long time to complete the request.
|
||||
This code indicates that the server has received and is processing the request,
|
||||
but no response is available yet.[6]
|
||||
This prevents the client from timing out and assuming the request was lost.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,116 +1,116 @@
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http'
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
|
||||
|
||||
export class status200 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 200,
|
||||
text: 'OK',
|
||||
description: `Standard response for successful HTTP requests.
|
||||
constructor() {
|
||||
super({
|
||||
code: 200,
|
||||
text: 'OK',
|
||||
description: `Standard response for successful HTTP requests.
|
||||
The actual response will depend on the request method used.
|
||||
In a GET request, the response will contain an entity corresponding to the requested resource.
|
||||
In a POST request, the response will contain an entity describing or containing the result of the action.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status201 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 201,
|
||||
text: 'Created',
|
||||
description: `The request has been fulfilled, resulting in the creation of a new resource.`
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 201,
|
||||
text: 'Created',
|
||||
description: `The request has been fulfilled, resulting in the creation of a new resource.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status202 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 202,
|
||||
text: 'Accepted',
|
||||
description: `The request has been accepted for processing, but the processing has not been completed.
|
||||
constructor() {
|
||||
super({
|
||||
code: 202,
|
||||
text: 'Accepted',
|
||||
description: `The request has been accepted for processing, but the processing has not been completed.
|
||||
The request might or might not be eventually acted upon, and may be disallowed when processing occurs.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status203 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 203,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `The server is a transforming proxy (e.g. a Web accelerator)
|
||||
constructor() {
|
||||
super({
|
||||
code: 203,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `The server is a transforming proxy (e.g. a Web accelerator)
|
||||
that received a 200 OK from its origin, but is returning a modified version of the origin's response.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status204 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 204,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `The server successfully processed the request and is not returning any content.`
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 204,
|
||||
text: 'Non-Authoritative Information',
|
||||
description: `The server successfully processed the request and is not returning any content.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status205 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 205,
|
||||
text: 'Reset Content',
|
||||
description: `The server successfully processed the request, but is not returning any content.
|
||||
constructor() {
|
||||
super({
|
||||
code: 205,
|
||||
text: 'Reset Content',
|
||||
description: `The server successfully processed the request, but is not returning any content.
|
||||
Unlike a 204 response, this response requires that the requester reset the document view.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status206 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 206,
|
||||
text: 'Partial Content',
|
||||
description: `The server is delivering only part of the resource (byte serving)
|
||||
constructor() {
|
||||
super({
|
||||
code: 206,
|
||||
text: 'Partial Content',
|
||||
description: `The server is delivering only part of the resource (byte serving)
|
||||
due to a range header sent by the client.
|
||||
The range header is used by HTTP clients to enable resuming of interrupted downloads,
|
||||
or split a download into multiple simultaneous streams.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status207 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 207,
|
||||
text: 'Multi-Status',
|
||||
description: `The message body that follows is an XML message
|
||||
constructor() {
|
||||
super({
|
||||
code: 207,
|
||||
text: 'Multi-Status',
|
||||
description: `The message body that follows is an XML message
|
||||
and can contain a number of separate response codes,
|
||||
depending on how many sub-requests were made.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status208 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 208,
|
||||
text: 'Already Reported',
|
||||
description: `The members of a DAV binding have already been enumerated
|
||||
constructor() {
|
||||
super({
|
||||
code: 208,
|
||||
text: 'Already Reported',
|
||||
description: `The members of a DAV binding have already been enumerated
|
||||
in a preceding part of the (multistatus) response,
|
||||
and are not being included again.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class status226 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 226,
|
||||
text: 'IM Used',
|
||||
description: `The server has fulfilled a request for the resource,
|
||||
constructor() {
|
||||
super({
|
||||
code: 226,
|
||||
text: 'IM Used',
|
||||
description: `The server has fulfilled a request for the resource,
|
||||
and the response is a representation of the result of one or more instance-manipulations
|
||||
applied to the current instance.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http'
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
|
||||
|
||||
export class status300 extends HttpStatus {
|
||||
constructor() {
|
||||
@ -9,7 +9,7 @@ export class status300 extends HttpStatus {
|
||||
(via agent-driven content negotiation).
|
||||
For example, this code could be used to present multiple video format options,
|
||||
to list files with different filename extensions, or to suggest word-sense disambiguation.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ export class status301 extends HttpStatus {
|
||||
code: 301,
|
||||
text: 'Moved Permanently',
|
||||
description: `This and all future requests should be directed to the given URI.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ export class status302 extends HttpStatus {
|
||||
[20] but popular browsers implemented 302 with the functionality of a 303 See Other.
|
||||
Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviours.[21]
|
||||
However, some Web applications and frameworks use the 302 status code as if it were the 303.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export class status303 extends HttpStatus {
|
||||
When received in response to a POST (or PUT/DELETE),
|
||||
the client should presume that the server has received the data and should issue a redirect
|
||||
with a separate GET message.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ export class status304 extends HttpStatus {
|
||||
since the version specified by the request headers If-Modified-Since or If-None-Match.
|
||||
In such case, there is no need to retransmit the resource since the client
|
||||
still has a previously-downloaded copy.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ export class status305 extends HttpStatus {
|
||||
the address for which is provided in the response. Many HTTP clients (such as Mozilla[25]
|
||||
and Internet Explorer) do not correctly handle responses with this status code,
|
||||
primarily for security reasons.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ export class status306 extends HttpStatus {
|
||||
code: 306,
|
||||
text: 'Switch Proxy',
|
||||
description: `No longer used. Originally meant "Subsequent requests should use the specified proxy."`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ export class status307 extends HttpStatus {
|
||||
In contrast to how 302 was historically implemented,
|
||||
the request method is not allowed to be changed when reissuing the original request.
|
||||
For example, a POST request should be repeated using another POST request.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,6 +109,6 @@ export class status308 extends HttpStatus {
|
||||
description: `The request and all future requests should be repeated using another URI.
|
||||
307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
|
||||
So, for example, submitting a form to a permanently redirected resource may continue smoothly.`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,56 +1,52 @@
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http'
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
|
||||
|
||||
export class status400 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 400,
|
||||
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).`
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 400,
|
||||
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 status401 extends HttpStatus {
|
||||
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.
|
||||
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.
|
||||
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.`
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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.`
|
||||
})
|
||||
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.`
|
||||
})
|
||||
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,
|
||||
text: 'Not Found',
|
||||
description: `The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.`
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 404,
|
||||
text: 'Not Found',
|
||||
description: `The requested resource could not be found but may be available in the future. Subsequent requests by the client are permissible.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,115 +1,115 @@
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http'
|
||||
import { HttpStatus, TStatusGroup } from './smartstatus.classes.http';
|
||||
|
||||
export class status500 extends HttpStatus {
|
||||
constructor () {
|
||||
super({
|
||||
code: 500,
|
||||
text: 'Internal Server Error',
|
||||
description: 'A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.'
|
||||
})
|
||||
constructor() {
|
||||
super({
|
||||
code: 500,
|
||||
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).`
|
||||
})
|
||||
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.`
|
||||
})
|
||||
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.`
|
||||
})
|
||||
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
|
||||
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.`
|
||||
})
|
||||
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.`
|
||||
})
|
||||
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.`
|
||||
})
|
||||
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`
|
||||
})
|
||||
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`
|
||||
})
|
||||
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.
|
||||
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)`
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,23 @@
|
||||
export type TStatusGroup = 'clientError' | 'serverError'
|
||||
export type TStatusGroup = 'clientError' | 'serverError';
|
||||
|
||||
export class HttpStatus {
|
||||
code: number
|
||||
text: string
|
||||
description: string
|
||||
constructor (optionsArg: {
|
||||
code: number,
|
||||
text: string,
|
||||
description: string
|
||||
}) {
|
||||
|
||||
protected static statusMap: {[key:string]: HttpStatus} = {};
|
||||
public static getHttpStatusByString (codeArg: number) {
|
||||
return HttpStatus.statusMap[codeArg.toString()];
|
||||
}
|
||||
code: number;
|
||||
text: string;
|
||||
description: string;
|
||||
constructor(optionsArg: { code: number; text: string; description: string }) {
|
||||
this.code = optionsArg.code;
|
||||
this.text = optionsArg.text;
|
||||
this.description = optionsArg.description;
|
||||
HttpStatus.statusMap[this.code.toString()] = this;
|
||||
}
|
||||
}
|
||||
|
||||
export * from './smartstatus.classes.http.1xx'
|
||||
export * from './smartstatus.classes.http.2xx'
|
||||
export * from './smartstatus.classes.http.3xx'
|
||||
export * from './smartstatus.classes.http.4xx'
|
||||
export * from './smartstatus.classes.http.5xx'
|
||||
export * from './smartstatus.classes.http.1xx';
|
||||
export * from './smartstatus.classes.http.2xx';
|
||||
export * from './smartstatus.classes.http.3xx';
|
||||
export * from './smartstatus.classes.http.4xx';
|
||||
export * from './smartstatus.classes.http.5xx';
|
||||
|
Reference in New Issue
Block a user