Переглянути джерело

Update status codes

Add other status codes.
refactor/new-arch
TheoryOfNekomata 6 місяці тому
джерело
коміт
9c08e00fdf
1 змінених файлів з 17 додано та 10 видалено
  1. +17
    -10
      packages/core/src/extenders/http/status-codes.ts

+ 17
- 10
packages/core/src/extenders/http/status-codes.ts Переглянути файл

@@ -1,3 +1,5 @@
// https://github.com/prettymuchbryce/http-status-codes

export const HTTP_STATUS_CONTINUE = 100 as const;
export const HTTP_STATUS_SWITCHING_PROTOCOLS = 101 as const;
export const HTTP_STATUS_PROCESSING = 102 as const;
@@ -26,14 +28,6 @@ export const HTTP_STATUS_PARTIAL_CONTENT = 206 as const;
export const HTTP_STATUS_MULTI_STATUS = 207 as const;
export const HTTP_STATUS_ALREADY_REPORTED = 208 as const;
export const HTTP_STATUS_IM_USED = 226 as const;
export const HTTP_STATUS_MULTIPLE_CHOICES = 300 as const;
export const HTTP_STATUS_MOVED_PERMANENTLY = 301 as const;
export const HTTP_STATUS_FOUND = 302 as const;
export const HTTP_STATUS_SEE_OTHER = 303 as const;
export const HTTP_STATUS_NOT_MODIFIED = 304 as const;
export const HTTP_STATUS_USE_PROXY = 305 as const;
export const HTTP_STATUS_TEMPORARY_REDIRECT = 307 as const;
export const HTTP_STATUS_PERMANENT_REDIRECT = 308 as const;

export const RESOLVED_STATUS_CODES = [
HTTP_STATUS_OK,
@@ -54,6 +48,15 @@ export const isResolvedStatusCode = (statusCode: StatusCode): statusCode is Reso
RESOLVED_STATUS_CODES.includes(statusCode as ResolvedStatusCode)
);

export const HTTP_STATUS_MULTIPLE_CHOICES = 300 as const;
export const HTTP_STATUS_MOVED_PERMANENTLY = 301 as const;
export const HTTP_STATUS_FOUND = 302 as const;
export const HTTP_STATUS_SEE_OTHER = 303 as const;
export const HTTP_STATUS_NOT_MODIFIED = 304 as const;
export const HTTP_STATUS_USE_PROXY = 305 as const;
export const HTTP_STATUS_TEMPORARY_REDIRECT = 307 as const;
export const HTTP_STATUS_PERMANENT_REDIRECT = 308 as const;

export const REDIRECT_STATUS_CODES = [
HTTP_STATUS_MULTIPLE_CHOICES,
HTTP_STATUS_MOVED_PERMANENTLY,
@@ -101,11 +104,13 @@ export const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415 as const;
export const HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416 as const;
export const HTTP_STATUS_EXPECTATION_FAILED = 417 as const;
export const HTTP_STATUS_TEAPOT = 418 as const;
export const HTTP_STATUS_INSUFFICIENT_SPACE_ON_RESOURCE = 419 as const;
export const HTTP_STATUS_METHOD_FAILURE = 420 as const;
export const HTTP_STATUS_MISDIRECTED_REQUEST = 421 as const;
export const HTTP_STATUS_UNPROCESSABLE_ENTITY = 422 as const;
export const HTTP_STATUS_LOCKED = 423 as const;
export const HTTP_STATUS_FAILED_DEPENDENCY = 424 as const;
export const HTTP_STATUS_UNORDERED_COLLECTION = 425 as const;
export const HTTP_STATUS_TOO_EARLY = 425 as const;
export const HTTP_STATUS_UPGRADE_REQUIRED = 426 as const;
export const HTTP_STATUS_PRECONDITION_REQUIRED = 428 as const;
export const HTTP_STATUS_TOO_MANY_REQUESTS = 429 as const;
@@ -132,11 +137,13 @@ export const CLIENT_ERROR_STATUS_CODES = [
HTTP_STATUS_RANGE_NOT_SATISFIABLE,
HTTP_STATUS_EXPECTATION_FAILED,
HTTP_STATUS_TEAPOT,
HTTP_STATUS_INSUFFICIENT_SPACE_ON_RESOURCE,
HTTP_STATUS_METHOD_FAILURE,
HTTP_STATUS_MISDIRECTED_REQUEST,
HTTP_STATUS_UNPROCESSABLE_ENTITY,
HTTP_STATUS_LOCKED,
HTTP_STATUS_FAILED_DEPENDENCY,
HTTP_STATUS_UNORDERED_COLLECTION,
HTTP_STATUS_TOO_EARLY,
HTTP_STATUS_UPGRADE_REQUIRED,
HTTP_STATUS_PRECONDITION_REQUIRED,
HTTP_STATUS_TOO_MANY_REQUESTS,


Завантаження…
Відмінити
Зберегти