-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpStatusCode.ts
More file actions
53 lines (51 loc) · 2.07 KB
/
Copy pathHttpStatusCode.ts
File metadata and controls
53 lines (51 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Type, type TEnum } from '@sinclair/typebox'
/**
* @see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
*/
export enum HttpStatusCode {
/**
* 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.
*/
OK = 200,
/**
* The request has been fulfilled, resulting in the creation of a new resource.
*/
CREATED = 201,
/**
* 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.
*/
ACCEPTED = 202,
/**
* 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).
*/
BAD_REQUEST = 400,
/**
* Similar to 403 Forbidden, but specifically for use when authentication is
* required and has failed or has not yet been provided. 401 semantically
* means "unauthenticated", the user does not have valid authentication
* credentials for the target resource.
*/
UNAUTHORIZED = 401,
/**
* The request contained valid data and was understood by the server, but the server is refusing action.
* The request should not be repeated.
*/
FORBIDDEN = 403,
/**
* The requested resource could not be found but may be available in the future.
* Subsequent requests by the client are permissible.
*/
NOT_FOUND = 404,
/**
* Indicates that the request could not be processed because of conflict in the request,
* such as an edit conflict between multiple simultaneous updates.
*/
CONFLICT = 409,
/**
* A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
*/
INTERNAL_SERVER_ERROR = 500,
}
export const StatusCode: TEnum<typeof HttpStatusCode> =
Type.Enum(HttpStatusCode)