fix(server): 🐛 error mime type

master
Xeronith 2022-09-06 08:38:23 +04:30
rodzic 060c184daf
commit 5902d2e50f
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -65,6 +65,17 @@ func New() IServer {
DisableStartupMessage: true, DisableStartupMessage: true,
Views: html.New("./views", ".html"), Views: html.New("./views", ".html"),
BodyLimit: int(bodyLimit), BodyLimit: int(bodyLimit),
ErrorHandler: func(ctx *fiber.Ctx, err error) error {
code := fiber.StatusInternalServerError
if e, ok := err.(*fiber.Error); ok {
code = e.Code
}
ctx.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSONCharsetUTF8)
return ctx.Status(code).SendString(err.Error())
},
}) })
framework.Static("/media", config.UPLOAD_PATH) framework.Static("/media", config.UPLOAD_PATH)