🐛 Bug fixes on uri conflict

This commit is contained in:
LittleSheep 2024-05-06 22:27:37 +08:00
parent d66b591f92
commit 1603d9f438
2 changed files with 2 additions and 2 deletions

View File

@ -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)

View File

@ -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)