webserver-log-analyser/utils/http_codes.rb

20 lines
392 B
Ruby
Raw Permalink Normal View History

2024-05-16 15:37:02 +00:00
HTTP_CLIENT_ERROR_RANGE = 400..499
HTTP_SERVER_ERROR_RANGE = 500..599
HTTP_INFORMATIONAL_RANGE = 100..199
HTTP_SUCCESS_RANGE = 200..299
def is_client_err?(code)
HTTP_CLIENT_ERROR_RANGE === code
end
def is_server_err?(code)
2024-05-17 11:08:56 +00:00
HTTP_SERVER_ERROR_RANGE === code
end
def is_info_status?(code)
HTTP_INFORMATIONAL_RANGE === code
end
2024-05-16 15:37:02 +00:00
2024-05-17 11:08:56 +00:00
def is_successful?(code)
HTTP_SUCCESS_RANGE === code
2024-05-16 15:37:02 +00:00
end