🔪 change signature method

pull/977/head
renanbastos93 2020-10-28 01:25:08 -03:00
parent e41bf7f08f
commit 1b4c0432c0
1 changed files with 2 additions and 7 deletions

View File

@ -43,9 +43,6 @@ type Config struct {
//
// Optional. Default: ""
NotFoundFile string `json:"not_found_file"`
// share context with SendFile method
ctx *fiber.Ctx
}
// ConfigDefault is the default config
@ -95,7 +92,6 @@ func New(config ...Config) fiber.Handler {
return c.Next()
}
cfg.ctx = c
method := c.Method()
// We only serve static assets on GET or HEAD methods
@ -114,17 +110,16 @@ func New(config ...Config) fiber.Handler {
path = "/" + path
}
return SendFile(path)
return SendFile(c, path)
}
}
// SendFile ...
func SendFile(param string) (err error) {
func SendFile(c *fiber.Ctx, param string) (err error) {
var (
file http.File
stat os.FileInfo
)
c := cfg.ctx
method := c.Method()
// We only serve static assets on GET or HEAD methods