@@ -7,7 +7,6 @@ package fiber
77import (
88 "bufio"
99 "crypto/tls"
10- "flag"
1110 "fmt"
1211 "io/ioutil"
1312 "log"
@@ -26,7 +25,7 @@ import (
2625)
2726
2827// Version of Fiber
29- const Version = "1.8.2 "
28+ const Version = "1.8.3 "
3029
3130type (
3231 // App denotes the Fiber application.
5150 ServerHeader string `default:""`
5251 // Enables handler values to be immutable even if you return from handler
5352 Immutable bool `default:"false"`
53+ // Deprecated v1.8.2
5454 // Enables GZip / Deflate compression for all responses
5555 Compression bool `default:"false"`
5656 // Max body size that the server accepts
@@ -64,11 +64,6 @@ type (
6464 }
6565)
6666
67- func init () {
68- flag .Bool ("prefork" , false , "Use prefork" )
69- flag .Bool ("child" , false , "Is a child process" )
70- }
71-
7267// New : https://fiber.wiki/application#new
7368func New (settings ... * Settings ) * App {
7469 var prefork , child bool
@@ -90,17 +85,21 @@ func New(settings ...*Settings) *App {
9085 }
9186 // If settings exist, set some defaults
9287 if len (settings ) > 0 {
93- if ! settings [0 ].Prefork { // Default to -prefork flag if false
94- settings [0 ].Prefork = prefork
88+ app .Settings = settings [0 ] // Set custom settings
89+ if ! app .Settings .Prefork { // Default to -prefork flag if false
90+ app .Settings .Prefork = prefork
9591 }
96- if settings [ 0 ] .BodyLimit == 0 { // Default MaxRequestBodySize
97- settings [ 0 ] .BodyLimit = 4 * 1024 * 1024
92+ if app . Settings .BodyLimit == 0 { // Default MaxRequestBodySize
93+ app . Settings .BodyLimit = 4 * 1024 * 1024
9894 }
99- if settings [ 0 ] .Immutable { // Replace unsafe conversion funcs
95+ if app . Settings .Immutable { // Replace unsafe conversion funcs
10096 getString = func (b []byte ) string { return string (b ) }
10197 getBytes = func (s string ) []byte { return []byte (s ) }
10298 }
103- app .Settings = settings [0 ] // Set custom settings
99+ }
100+ // Deprecated
101+ if app .Settings .Compression {
102+ log .Println ("Warning: Settings.Compression is deprecated since v1.8.2, please use github.com/gofiber/compression instead." )
104103 }
105104 return app
106105}
@@ -201,14 +200,14 @@ func (app *App) All(path string, handlers ...func(*Ctx)) *App {
201200}
202201
203202// WebSocket : https://fiber.wiki/application#websocket
204- func (app * App ) WebSocket (path string , handle func (* Conn )) * App {
203+ func (app * App ) WebSocket (path string , handle func (* Ctx )) * App {
205204 app .registerWebSocket (http .MethodGet , path , handle )
206205 return app
207206}
208207
209208// Recover : https://fiber.wiki/application#recover
210209func (app * App ) Recover (handler func (* Ctx )) {
211- log .Println ("Warning: Recover(handler ) is deprecated since v1.8.2, please use middleware.Recover(handler, error) instead." )
210+ log .Println ("Warning: app. Recover() is deprecated since v1.8.2, please use github.com/gofiber/recover instead." )
212211 app .recover = handler
213212}
214213
@@ -362,9 +361,8 @@ func (app *App) newServer() *fasthttp.Server {
362361 Name : app .Settings .ServerHeader ,
363362 MaxRequestBodySize : app .Settings .BodyLimit ,
364363 NoDefaultServerHeader : app .Settings .ServerHeader == "" ,
365-
366- Logger : & disableLogger {},
367- LogAllErrors : false ,
364+ Logger : & disableLogger {},
365+ LogAllErrors : false ,
368366 ErrorHandler : func (ctx * fasthttp.RequestCtx , err error ) {
369367 if err .Error () == "body size exceeds the given limit" {
370368 ctx .Response .SetStatusCode (413 )
0 commit comments