Skip to content

Commit

Permalink
fix custom
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Oct 4, 2023
1 parent a5837b2 commit 771b59c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ var CustomReplacer = map[string]string{
}

func RegisterCustom(app *fiber.App) {
for _, v := range CustomReplacer {
app.All(fmt.Sprintf("/%s/*", v), func(c *fiber.Ctx) error {
source := strings.TrimPrefix(c.Path(), fmt.Sprintf("/%s", v))
for k, v := range CustomReplacer {
app.All(fmt.Sprintf("/%s/*", k), func(c *fiber.Ctx) error {
source := strings.TrimPrefix(c.Path(), fmt.Sprintf("/%s", k))
uri := fmt.Sprintf("%s%s", v, source)
fmt.Println(uri)
resp, err := utils.Get(uri, nil)
if err != nil {
return Catch(c, err)
Expand Down

0 comments on commit 771b59c

Please sign in to comment.