mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Update to version 11.0.4. Read https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104
Former-commit-id: 2c2c32afe31fe94543d145ab8c8475d7b4392ff1
This commit is contained in:
@@ -229,6 +229,14 @@ var WithoutPathCorrection = func(app *Application) {
|
||||
app.config.DisablePathCorrection = true
|
||||
}
|
||||
|
||||
// WithoutPathCorrectionRedirection disables the PathCorrectionRedirection setting.
|
||||
//
|
||||
// See `Configuration`.
|
||||
var WithoutPathCorrectionRedirection = func(app *Application) {
|
||||
app.config.DisablePathCorrection = false
|
||||
app.config.DisablePathCorrectionRedirection = true
|
||||
}
|
||||
|
||||
// WithoutBodyConsumptionOnUnmarshal disables BodyConsumptionOnUnmarshal setting.
|
||||
//
|
||||
// See `Configuration`.
|
||||
@@ -380,14 +388,24 @@ type Configuration struct {
|
||||
// Defaults to false.
|
||||
DisableInterruptHandler bool `json:"disableInterruptHandler,omitempty" yaml:"DisableInterruptHandler" toml:"DisableInterruptHandler"`
|
||||
|
||||
// DisablePathCorrection corrects and redirects the requested path to the registered path
|
||||
// DisablePathCorrection corrects and redirects or executes directly the handler of
|
||||
// the requested path to the registered path
|
||||
// for example, if /home/ path is requested but no handler for this Route found,
|
||||
// then the Router checks if /home handler exists, if yes,
|
||||
// (permant)redirects the client to the correct path /home
|
||||
// (permant)redirects the client to the correct path /home.
|
||||
//
|
||||
// See `DisablePathCorrectionRedirection` to enable direct handler execution instead of redirection.
|
||||
//
|
||||
// Defaults to false.
|
||||
DisablePathCorrection bool `json:"disablePathCorrection,omitempty" yaml:"DisablePathCorrection" toml:"DisablePathCorrection"`
|
||||
|
||||
// DisablePathCorrectionRedirection works whenever configuration.DisablePathCorrection is set to false
|
||||
// and if DisablePathCorrectionRedirection set to true then it will fire the handler of the matching route without
|
||||
// the last slash ("/") instead of send a redirection status.
|
||||
//
|
||||
// Defaults to false.
|
||||
DisablePathCorrectionRedirection bool `json:"disablePathCorrectionRedirection,omitempty" yaml:"DisablePathCorrectionRedirection" toml:"DisablePathCorrectionRedirection"`
|
||||
|
||||
// EnablePathEscape when is true then its escapes the path, the named parameters (if any).
|
||||
// Change to false it if you want something like this https://github.com/kataras/iris/issues/135 to work
|
||||
//
|
||||
@@ -527,6 +545,13 @@ func (c Configuration) GetDisablePathCorrection() bool {
|
||||
return c.DisablePathCorrection
|
||||
}
|
||||
|
||||
// GetDisablePathCorrectionRedirection returns the Configuration#DisablePathCorrectionRedirection field.
|
||||
// If DisablePathCorrectionRedirection set to true then it will fire the handler of the matching route without
|
||||
// the last slash ("/") instead of send a redirection status.
|
||||
func (c Configuration) GetDisablePathCorrectionRedirection() bool {
|
||||
return c.DisablePathCorrectionRedirection
|
||||
}
|
||||
|
||||
// GetEnablePathEscape is the Configuration#EnablePathEscape,
|
||||
// returns true when its escapes the path, the named parameters (if any).
|
||||
func (c Configuration) GetEnablePathEscape() bool {
|
||||
@@ -668,6 +693,10 @@ func WithConfiguration(c Configuration) Configurator {
|
||||
main.DisablePathCorrection = v
|
||||
}
|
||||
|
||||
if v := c.DisablePathCorrectionRedirection; v {
|
||||
main.DisablePathCorrectionRedirection = v
|
||||
}
|
||||
|
||||
if v := c.EnablePathEscape; v {
|
||||
main.EnablePathEscape = v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user