mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 11:26:37 +03:00
17 lines
368 B
JavaScript
17 lines
368 B
JavaScript
'use strict';
|
|
|
|
export function statusCodeType(statusCode) {
|
|
if (statusCode < 100 || statusCode > 599) {
|
|
throw new Error('invalid HTTP code');
|
|
}
|
|
let res = 'success';
|
|
if (statusCode >= 300 && statusCode < 400) {
|
|
res = 'redirect';
|
|
} else if (statusCode >= 400) {
|
|
res = 'error';
|
|
} else if (statusCode < 200) {
|
|
res = 'info';
|
|
}
|
|
return res;
|
|
}
|