mirror of
https://github.com/gofiber/fiber.git
synced 2025-05-31 11:52:41 +00:00
♻️Use constants for most default properties
This commit is contained in:
parent
34f8958de0
commit
ccd2fef610
27
app.go
27
app.go
@ -210,22 +210,23 @@ type Static struct {
|
||||
}
|
||||
|
||||
// default settings
|
||||
var (
|
||||
defaultBodyLimit = 4 * 1024 * 1024
|
||||
defaultConcurrency = 256 * 1024
|
||||
defaultReadBufferSize = 4096
|
||||
defaultWriteBufferSize = 4096
|
||||
defaultErrorHandler = func(ctx *Ctx, err error) {
|
||||
code := StatusInternalServerError
|
||||
if e, ok := err.(*Error); ok {
|
||||
code = e.Code
|
||||
}
|
||||
ctx.Set(HeaderContentType, MIMETextPlainCharsetUTF8)
|
||||
ctx.Status(code).SendString(err.Error())
|
||||
}
|
||||
const (
|
||||
defaultBodyLimit = 4 * 1024 * 1024
|
||||
defaultConcurrency = 256 * 1024
|
||||
defaultReadBufferSize = 4096
|
||||
defaultWriteBufferSize = 4096
|
||||
defaultCompressedFileSuffix = ".fiber.gz"
|
||||
)
|
||||
|
||||
var defaultErrorHandler = func(ctx *Ctx, err error) {
|
||||
code := StatusInternalServerError
|
||||
if e, ok := err.(*Error); ok {
|
||||
code = e.Code
|
||||
}
|
||||
ctx.Set(HeaderContentType, MIMETextPlainCharsetUTF8)
|
||||
ctx.Status(code).SendString(err.Error())
|
||||
}
|
||||
|
||||
// New creates a new Fiber named instance.
|
||||
// You can pass an optional settings by passing a *Settings struct.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user