From ccd2fef610bb4c34dfe6036ecda0af4c2fadbc03 Mon Sep 17 00:00:00 2001 From: Roger Guldbrandsen Date: Mon, 13 Jul 2020 00:49:56 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8FUse=20constants=20for=20most?= =?UTF-8?q?=20default=20properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.go | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/app.go b/app.go index 3e047c7d..443d9067 100644 --- a/app.go +++ b/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. //