chore: stabilize lint and verify builds

This commit is contained in:
2026-02-06 11:51:32 +08:00
parent edede17880
commit 1782f64417
114 changed files with 3032 additions and 1345 deletions

View File

@@ -35,13 +35,13 @@ func New(config ...Config) fiber.Handler {
once sync.Once
)
return func(c fiber.Ctx) error {
return func(ctx fiber.Ctx) error {
// Set prefix
once.Do(
func() {
prefix = strings.ReplaceAll(c.Route().Path, "*", "")
prefix = strings.ReplaceAll(ctx.Route().Path, "*", "")
forwardedPrefix := getForwardedPrefix(c)
forwardedPrefix := getForwardedPrefix(ctx)
if forwardedPrefix != "" {
prefix = forwardedPrefix + prefix
}
@@ -53,26 +53,28 @@ func New(config ...Config) fiber.Handler {
},
)
p := c.Path(utils.CopyString(c.Params("*")))
p := ctx.Path(utils.CopyString(ctx.Params("*")))
switch p {
case defaultIndex:
c.Type("html")
return index.Execute(c, cfg)
ctx.Type("html")
return index.Execute(ctx, cfg)
case defaultDocURL:
var doc string
if doc, err = swag.ReadDoc(cfg.InstanceName); err != nil {
return err
return fmt.Errorf("read swagger doc: %w", err)
}
return c.Type("json").SendString(doc)
return ctx.Type("json").SendString(doc)
case "", "/":
return c.Redirect().To(path.Join(prefix, defaultIndex))
return ctx.Redirect().To(path.Join(prefix, defaultIndex))
default:
// return fs(c)
return static.New("/swagger", static.Config{
FS: swaggerFiles.FS,
Browse: true,
})(c)
})(ctx)
}
}
}