Former-commit-id: 26b0b59ba54caac38d726d7fec562a5d6a0a76e3
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-06-18 09:36:47 +03:00
parent a7a9e62ffa
commit 43502ed047
5 changed files with 20 additions and 10 deletions

View File

@ -421,7 +421,7 @@ New Context Methods:
- `Context.IsSSL() bool` reports whether the request is under HTTPS SSL (New `Configuration.SSLProxyHeaders` and `HostProxyHeaders` fields too).
- `Context.GzipReader(enable bool)` method and `iris.GzipReader` middleware to enable future request read body calls to decompress data using gzip, [example](_examples/request-body/read-gzip).
- `Context.RegisterDependency(v interface{})` and `Context.RemoveDependency(typ reflect.Type)` to register/remove struct dependencies on serve-time through a middleware.
- `Context.RegisterDependency(v interface{})` and `Context.UnregisterDependency(typ reflect.Type)` to register/remove struct dependencies on serve-time through a middleware.
- `Context.SetID(id interface{})` and `Context.GetID() interface{}` added to register a custom unique indetifier to the Context, if necessary.
- `Context.GetDomain() string` returns the domain.
- `Context.AddCookieOptions(...CookieOption)` adds options for `SetCookie`, `SetCookieKV, UpsertCookie` and `RemoveCookie` methods for the current request.

View File

@ -76,7 +76,7 @@ type UnauthenticatedUserController struct{}
// Get registers a route that will be executed when authentication is not passed
// (see UserController.Get) too.
func (c *UnauthenticatedUserController) Get() string {
return `custom action to redirect on authentication page`
return "custom action to redirect on authentication page"
}
// PostLogin serves

View File

@ -23,6 +23,10 @@ func newApp() *iris.Application {
// Stops the execution and fires an error before server boot.
app.SetRegisterRule(iris.RouteError)
// If ctx.StopExecution or StopWithXXX then the next route will be executed
// (see mvc/authenticated-controller example too).
app.SetRegisterRule(iris.RouteOverlap)
*/
app.Get("/", getHandler)

View File

@ -771,9 +771,15 @@ func (tc TunnelingConfiguration) createTunnel(tunnelAPIRequest ngrokTunnel, publ
return nil
}
// Configuration the whole configuration for an iris instance
// these can be passed via options also, look at the top of this file(configuration.go).
// Configuration is a valid OptionSetter.
// Configuration holds the necessary settings for an Iris Application instance.
// All fields are optionally, the default values will work for a common web application.
//
// A Configuration value can be passed through `WithConfiguration` Configurator.
// Usage:
// conf := iris.Configuration{ ... }
// app := iris.New()
// app.Configure(iris.WithConfiguration(conf)) OR
// app.Run/Listen(..., iris.WithConfiguration(conf)).
type Configuration struct {
// vhost is private and set only with .Run/Listen methods, it cannot be changed after the first set.
// It can be retrieved by the context if needed (i.e router for subdomains)

View File

@ -1163,13 +1163,13 @@ type Context interface {
// through APIContainer(app.ConfigureContainer) or MVC(mvc.New)
// in sake of minimum performance cost.
//
// See `UnRegisterDependency` too.
// See `UnregisterDependency` too.
RegisterDependency(v interface{})
// UnRegisterDependency removes a dependency based on its type.
// UnregisterDependency removes a dependency based on its type.
// Reports whether a dependency with that type was found and removed successfully.
//
// See `RegisterDependency` too.
UnRegisterDependency(typ reflect.Type) bool
UnregisterDependency(typ reflect.Type) bool
// Application returns the iris app instance which belongs to this context.
// Worth to notice that this function returns an interface
@ -5607,9 +5607,9 @@ func (ctx *context) RegisterDependency(v interface{}) {
})
}
// UnRegisterDependency removes a dependency based on its type.
// UnregisterDependency removes a dependency based on its type.
// Reports whether a dependency with that type was found and removed successfully.
func (ctx *context) UnRegisterDependency(typ reflect.Type) bool {
func (ctx *context) UnregisterDependency(typ reflect.Type) bool {
cv := ctx.Values().Get(DependenciesContextKey)
if cv != nil {
m, ok := cv.(DependenciesMap)