More optimizations and error handling

This commit is contained in:
Jacob Gunther
2022-08-22 02:58:44 -05:00
parent 2783f410d1
commit cd56955210
4 changed files with 47 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
package main
import (
"log"
"net/http"
"strconv"
@@ -23,8 +22,6 @@ func JavaStatusHandler(ctx *fiber.Ctx) error {
host, port, err := ParseAddress(ctx.Params("address"), 25565)
if err != nil {
log.Println(err)
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
}
@@ -38,7 +35,7 @@ func JavaStatusHandler(ctx *fiber.Ctx) error {
ctx.Set("X-Cache-Time-Remaining", strconv.Itoa(int(expiresAt.Seconds())))
}
return ctx.JSON(response)
return ctx.SendString(response)
}
func BedrockStatusHandler(ctx *fiber.Ctx) error {
@@ -58,7 +55,7 @@ func BedrockStatusHandler(ctx *fiber.Ctx) error {
ctx.Set("X-Cache-Time-Remaining", strconv.Itoa(int(expiresAt.Seconds())))
}
return ctx.JSON(response)
return ctx.SendString(response)
}
func IconHandler(ctx *fiber.Ctx) error {