mirror of https://github.com/gofiber/fiber.git
Refactor favicon middleware, avoid magic numbers. (#1919)
* Refactor favicon middleware, avoid magic numbers. * Introduce constant for path to favicon.pull/1924/head
parent
061c2a9e12
commit
68e922d733
|
@ -40,6 +40,7 @@ var ConfigDefault = Config{
|
|||
}
|
||||
|
||||
const (
|
||||
fPath = "/favicon.ico"
|
||||
hType = "image/x-icon"
|
||||
hAllow = "GET, HEAD, OPTIONS"
|
||||
hZero = "0"
|
||||
|
@ -97,7 +98,7 @@ func New(config ...Config) fiber.Handler {
|
|||
}
|
||||
|
||||
// Only respond to favicon requests
|
||||
if len(c.Path()) != 12 || c.Path() != "/favicon.ico" {
|
||||
if c.Path() != fPath {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue