debian-mirror-gitlab/app/assets/javascripts/lib/utils/http_status.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-03-04 22:38:38 +05:30
export const HTTP_STATUS_ABORTED = 0;
export const HTTP_STATUS_CREATED = 201;
export const HTTP_STATUS_ACCEPTED = 202;
export const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203;
export const HTTP_STATUS_NO_CONTENT = 204;
export const HTTP_STATUS_RESET_CONTENT = 205;
export const HTTP_STATUS_PARTIAL_CONTENT = 206;
export const HTTP_STATUS_MULTI_STATUS = 207;
export const HTTP_STATUS_ALREADY_REPORTED = 208;
export const HTTP_STATUS_IM_USED = 226;
export const HTTP_STATUS_METHOD_NOT_ALLOWED = 405;
export const HTTP_STATUS_CONFLICT = 409;
export const HTTP_STATUS_GONE = 410;
export const HTTP_STATUS_PAYLOAD_TOO_LARGE = 413;
export const HTTP_STATUS_UNPROCESSABLE_ENTITY = 422;
export const HTTP_STATUS_TOO_MANY_REQUESTS = 429;
2017-08-17 22:00:37 +05:30
2023-03-04 22:38:38 +05:30
// TODO move the rest of the status codes to primitive constants
// https://docs.gitlab.com/ee/development/fe_guide/style/javascript.html#export-constants-as-primitives
2018-11-18 11:00:15 +05:30
const httpStatusCodes = {
2017-08-17 22:00:37 +05:30
OK: 200,
2018-03-17 18:26:18 +05:30
BAD_REQUEST: 400,
2019-07-07 11:18:12 +05:30
UNAUTHORIZED: 401,
2019-02-15 15:39:39 +05:30
FORBIDDEN: 403,
2018-11-08 19:23:39 +05:30
NOT_FOUND: 404,
2020-10-24 23:57:45 +05:30
INTERNAL_SERVER_ERROR: 500,
2020-01-01 13:55:28 +05:30
SERVICE_UNAVAILABLE: 503,
2017-08-17 22:00:37 +05:30
};
2018-11-18 11:00:15 +05:30
export const successCodes = [
httpStatusCodes.OK,
2023-03-04 22:38:38 +05:30
HTTP_STATUS_CREATED,
HTTP_STATUS_ACCEPTED,
HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION,
HTTP_STATUS_NO_CONTENT,
HTTP_STATUS_RESET_CONTENT,
HTTP_STATUS_PARTIAL_CONTENT,
HTTP_STATUS_MULTI_STATUS,
HTTP_STATUS_ALREADY_REPORTED,
HTTP_STATUS_IM_USED,
2018-11-18 11:00:15 +05:30
];
export default httpStatusCodes;