1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-10 21:45:57 +00:00

add 'Configuration.PathIntelligence' and 'OnErrorCode' and 'OnAnyErrorCode' on APIContainer

Former-commit-id: bc3d0232106622063205f326bfa4ed3aa84179de
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-17 08:10:07 +03:00
parent 21a013569f
commit 1e20996330
10 changed files with 104 additions and 27 deletions

View File

@@ -25,26 +25,24 @@ type ConfigurationReadOnly interface {
// then the Router checks if /home handler exists, if yes,
// (permant)redirects the client to the correct path /home.
GetDisablePathCorrection() bool
// GetDisablePathCorrectionRedirection returns the Configuration#DisablePathCorrectionRedirection field.
// GetDisablePathCorrectionRedirection returns the Configuration.DisablePathCorrectionRedirection field.
// If DisablePathCorrectionRedirection set to true then it will handle paths as they are.
// it will fire the handler of the matching route without
// the last slash ("/") instead of send a redirection status.
GetDisablePathCorrectionRedirection() bool
// GetEnablePathIntelligence returns the Configuration.EnablePathIntelligence field.
GetEnablePathIntelligence() bool
// GetEnablePathEscape is the configuration.EnablePathEscape,
// returns true when its escapes the path, the named parameters (if any).
GetEnablePathEscape() bool
// GetForceLowercaseRouting returns the value of the `ForceLowercaseRouting` setting.
GetForceLowercaseRouting() bool
// GetFireMethodNotAllowed returns the configuration.FireMethodNotAllowed.
GetFireMethodNotAllowed() bool
// GetEnableOptimizations returns whether
// the application has performance optimizations enabled.
GetEnableOptimizations() bool
// GetFireMethodNotAllowed returns the configuration.FireMethodNotAllowed.
GetFireMethodNotAllowed() bool
// GetDisableBodyConsumptionOnUnmarshal returns the configuration.GetDisableBodyConsumptionOnUnmarshal,
// manages the reading behavior of the context's body readers/binders.
// If returns true then the body consumption by the `context.UnmarshalBody/ReadJSON/ReadXML`

View File

@@ -351,7 +351,7 @@ type Context interface {
// this request based on subdomain and request path.
//
// Order may change.
// Example: https://github.com/kataras/iris/tree/master/_examples/routing/not-found-suggests
// Example: https://github.com/kataras/iris/tree/master/_examples/routing/intelligence/manual
FindClosest(n int) []string
// IsWWW returns true if the current subdomain (if any) is www.
IsWWW() bool
@@ -1812,7 +1812,7 @@ func (ctx *context) Subdomain() (subdomain string) {
// this request based on subdomain and request path.
//
// Order may change.
// Example: https://github.com/kataras/iris/tree/master/_examples/routing/not-found-suggests
// Example: https://github.com/kataras/iris/tree/master/_examples/routing/intelligence/manual
func (ctx *context) FindClosest(n int) []string {
return ctx.Application().FindClosestPaths(ctx.Subdomain(), ctx.Path(), n)
}