mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-27 16:14:08 +03:00
statusCodeType fix
This commit is contained in:
parent
8d91427206
commit
baa7f27b9b
|
@ -1,12 +1,15 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
export function statusCodeType(statusCode) {
|
export function statusCodeType(statusCode) {
|
||||||
|
if (statusCode < 100 || statusCode > 599) {
|
||||||
|
throw 'invalid HTTP code';
|
||||||
|
}
|
||||||
let res = 'success';
|
let res = 'success';
|
||||||
if (statusCode >= 300 && statusCode < 400) {
|
if (statusCode >= 300 && statusCode < 400) {
|
||||||
res = 'redirect';
|
res = 'redirect';
|
||||||
} else if (statusCode >= 400) {
|
} else if (statusCode >= 400) {
|
||||||
res = 'error';
|
res = 'error';
|
||||||
} else if (statusCode < 100) {
|
} else if (statusCode < 200) {
|
||||||
res = 'info';
|
res = 'info';
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user