Refactor handler errors

This commit is contained in:
TwinProduction
2021-09-12 17:06:14 -04:00
parent d69df41ef0
commit d86afb2381
3 changed files with 10 additions and 17 deletions

View File

@@ -36,8 +36,7 @@ func uptimeBadgeHandler(writer http.ResponseWriter, request *http.Request) {
case "1h":
from = time.Now().Add(-time.Hour)
default:
writer.WriteHeader(http.StatusBadRequest)
_, _ = writer.Write([]byte("Durations supported: 7d, 24h, 1h"))
http.Error(writer, "Durations supported: 7d, 24h, 1h", http.StatusBadRequest)
return
}
key := variables["key"]