From 1603d9f438ed120ff90446a2190ac792af1f229c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 6 May 2024 22:27:37 +0800 Subject: [PATCH] :bug: Bug fixes on uri conflict --- pkg/server/channels_api.go | 2 +- pkg/server/startup.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/server/channels_api.go b/pkg/server/channels_api.go index 9d14eb3..3f8e437 100644 --- a/pkg/server/channels_api.go +++ b/pkg/server/channels_api.go @@ -37,7 +37,7 @@ func getChannelAvailability(c *fiber.Ctx) error { channel, _, err = services.GetAvailableChannelWithAlias(alias, user) } if err != nil { - return fiber.NewError(fiber.StatusForbidden, err.Error()) + return c.Status(fiber.StatusForbidden).JSON(channel) } return c.JSON(channel) diff --git a/pkg/server/startup.go b/pkg/server/startup.go index c56be90..8562d19 100644 --- a/pkg/server/startup.go +++ b/pkg/server/startup.go @@ -79,7 +79,7 @@ func NewServer() { { channels.Get("/", listChannel) channels.Get("/:channel", getChannel) - channels.Get("/:channel/available", authMiddleware, getChannelAvailability) + channels.Get("/:channel/availability", authMiddleware, getChannelAvailability) channels.Get("/me", authMiddleware, listOwnedChannel) channels.Get("/me/available", authMiddleware, listAvailableChannel)