Fix errors with indexing in status codes
parent
f780b69793
commit
e9e8bb8175
|
@ -54,15 +54,15 @@ const char *STATUS_CODES_500[] = {
|
|||
};
|
||||
|
||||
const char *get_message_from_status_code(int status_code) {
|
||||
if (status_code > 100 && status_code < 100 + NUM_100_STATUS_CODES) {
|
||||
if (status_code >= 100 && status_code < 100 + NUM_100_STATUS_CODES) {
|
||||
return STATUS_CODES_100[status_code - 100];
|
||||
} else if (status_code > 200 && status_code < 200 + NUM_200_STATUS_CODES) {
|
||||
} else if (status_code >= 200 && status_code < 200 + NUM_200_STATUS_CODES) {
|
||||
return STATUS_CODES_200[status_code - 200];
|
||||
} else if (status_code > 300 && status_code < 300 + NUM_300_STATUS_CODES) {
|
||||
} else if (status_code >= 300 && status_code < 300 + NUM_300_STATUS_CODES) {
|
||||
return STATUS_CODES_300[status_code - 300];
|
||||
} else if (status_code > 400 && status_code < 400 + NUM_400_STATUS_CODES) {
|
||||
} else if (status_code >= 400 && status_code < 400 + NUM_400_STATUS_CODES) {
|
||||
return STATUS_CODES_400[status_code - 400];
|
||||
} else if (status_code > 500 && status_code < 500 + NUM_500_STATUS_CODES) {
|
||||
} else if (status_code >= 500 && status_code < 500 + NUM_500_STATUS_CODES) {
|
||||
return STATUS_CODES_500[status_code - 500];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue