summaryrefslogtreecommitdiff
diff options
from:
to:
context:
space:
mode:
authorGravatar SayaAndy <saya.andy@posteo.com> 2025-11-01 09:32:02 +0700
committerGravatar SayaAndy <saya.andy@posteo.com> 2025-11-01 09:32:02 +0700
commit730728cd7f45f3d58aa4b213b967322b1ba5ea76 (patch)
tree6a776567ce9fefd2f0fbc00835b3b497ece30c7b
parent1862f232eb70105340a91e74a5630c233a411bca (diff)
downloadweb-730728cd7f45f3d58aa4b213b967322b1ba5ea76.tar.gz
web-730728cd7f45f3d58aa4b213b967322b1ba5ea76.zip
fix: change nocontent status to ok if there is content
-rw-r--r--internal/router/router.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/router/router.go b/internal/router/router.go
index 700fbbf..ef3f063 100644
--- a/internal/router/router.go
+++ b/internal/router/router.go
@@ -484,6 +484,10 @@ func (r *Router) generalPageSegment(c *fiber.Ctx, part string) error {
return c.Status(fiber.ErrInternalServerError.Code).SendString("failed to generate div")
}
+ if statusCode == fiber.StatusNoContent && len(content) != 0 {
+ statusCode = fiber.StatusOK
+ }
+
if statusCode >= 200 && statusCode < 300 && route.ToCache() != Disabled {
go r.supplements.PageCache.SetWithTTL(cacheKey, content, int64(len(content)), route.CacheDuration())
}