Skip to content
Snippets Groups Projects
Commit 3808b842 authored by Gabriel Zachmann's avatar Gabriel Zachmann
Browse files

fix 200 status code instead of 404

parent b6d9676a
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@ import (
"github.com/gofiber/fiber/v2"
fiberUtils "github.com/gofiber/fiber/v2/utils"
"github.com/oidc-mytoken/api/v0"
"github.com/oidc-mytoken/server/internal/model"
)
......@@ -40,6 +39,7 @@ func handleErrorHTML(ctx *fiber.Ctx, code int, msg string) error {
fiber.StatusInternalServerError,
fiber.StatusNotImplemented,
fiber.StatusHTTPVersionNotSupported:
ctx.Status(code)
err = ctx.Render(fmt.Sprintf("sites/%d", code), errorTemplateData, "layouts/main")
default:
return handleErrorJSON(ctx, code, msg)
......
......@@ -68,6 +68,7 @@ func Init() {
addRoutes(server)
server.Use(func(ctx *fiber.Ctx) error {
if ctx.Accepts(fiber.MIMETextHTML, fiber.MIMETextHTMLCharsetUTF8) != "" {
ctx.Status(fiber.StatusNotFound)
return ctx.Render("sites/404", map[string]interface{}{
"empty-navbar": true,
}, "layouts/main")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment