New returns a new blank Engine instance without any middleware attached. By default, the configuration is: - RedirectTrailingSlash: true - RedirectFixedPath: false - HandleMethodNotAllowed: false - ForwardedByClientIP: true - UseRawPath: false - UseEscapedPath: false - Unesca
(opts ...OptionFunc)
| 200 | // - UseEscapedPath: false |
| 201 | // - UnescapePathValues: true |
| 202 | func New(opts ...OptionFunc) *Engine { |
| 203 | debugPrintWARNINGNew() |
| 204 | engine := &Engine{ |
| 205 | RouterGroup: RouterGroup{ |
| 206 | Handlers: nil, |
| 207 | basePath: "/", |
| 208 | root: true, |
| 209 | }, |
| 210 | FuncMap: template.FuncMap{}, |
| 211 | RedirectTrailingSlash: true, |
| 212 | RedirectFixedPath: false, |
| 213 | HandleMethodNotAllowed: false, |
| 214 | ForwardedByClientIP: true, |
| 215 | RemoteIPHeaders: []string{"X-Forwarded-For", "X-Real-IP"}, |
| 216 | TrustedPlatform: defaultPlatform, |
| 217 | UseRawPath: false, |
| 218 | UseEscapedPath: false, |
| 219 | RemoveExtraSlash: false, |
| 220 | UnescapePathValues: true, |
| 221 | MaxMultipartMemory: defaultMultipartMemory, |
| 222 | trees: make(methodTrees, 0, 9), |
| 223 | delims: render.Delims{Left: "{{", Right: "}}"}, |
| 224 | secureJSONPrefix: "while(1);", |
| 225 | trustedProxies: []string{"0.0.0.0/0", "::/0"}, |
| 226 | trustedCIDRs: defaultTrustedCIDRs, |
| 227 | } |
| 228 | engine.engine = engine |
| 229 | engine.pool.New = func() any { |
| 230 | return engine.allocateContext(engine.maxParams) |
| 231 | } |
| 232 | return engine.With(opts...) |
| 233 | } |
| 234 | |
| 235 | // Default returns an Engine instance with the Logger and Recovery middleware already attached. |
| 236 | func Default(opts ...OptionFunc) *Engine { |