mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-07-16 17:48:49 +02:00
feat:#56 updated ifNoneMatch
This commit is contained in:
@ -34,12 +34,17 @@ func AddFeedRoutes(app model.AppType) {
|
|||||||
app.Fiber.Get("/api/feed", func(c fiber.Ctx) error {
|
app.Fiber.Get("/api/feed", func(c fiber.Ctx) error {
|
||||||
|
|
||||||
token := c.Query("token")
|
token := c.Query("token")
|
||||||
|
ifNoneMatch := c.Get("If-None-Match")
|
||||||
results, eTag, err := ical.Feed(app, token)
|
results, eTag, err := ical.Feed(app, token)
|
||||||
|
|
||||||
if errors.Is(err, ical.FeedDeletedError) {
|
if errors.Is(err, ical.FeedDeletedError) {
|
||||||
return c.SendStatus(fiber.StatusGone)
|
return c.SendStatus(fiber.StatusGone)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ifNoneMatch == eTag {
|
||||||
|
return c.SendStatus(fiber.StatusNotModified)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Failed to get feed", "error", err, "token", token)
|
slog.Error("Failed to get feed", "error", err, "token", token)
|
||||||
return c.SendStatus(fiber.StatusNotFound)
|
return c.SendStatus(fiber.StatusNotFound)
|
||||||
|
Reference in New Issue
Block a user