Skip to content

Commit

Permalink
refactor: use url param
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Jul 31, 2023
1 parent 3d662dd commit 2870ac2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
)

func init() {
App.Get("/versions", versionsHandler)
App.Get("/versions/:channel", versionsHandler)
}

func versionsHandler(c *fiber.Ctx) error {
channel := c.Query("channel", "stable")
channel := c.Params("channel")
if !utils.IsValidChannel(channel) {
return utils.Error(fmt.Sprintf("Argument %v of type channel is invalid. Must be one of %v", channel, strings.Join(utils.Channels[:], ", ")), c)
return utils.Error(fmt.Sprintf("Argument `%v` is not a valid channel. Must be one of %v", channel, strings.Join(utils.Channels[:], ", ")), c)
}
js, err := utils.ReadVersions("versions.json")

Expand Down

0 comments on commit 2870ac2

Please sign in to comment.