diff --git a/File-server.md b/File-server.md index 691af6f..a146e05 100644 --- a/File-server.md +++ b/File-server.md @@ -29,7 +29,7 @@ type DirOptions struct { ShowList bool // If `ShowList` is true then this function will be used instead // of the default one to show the list of files of a current requested directory(dir). - DirList func(ctx context.Context, dirName string, dir http.File) error + DirList func(ctx iris.Context, dirName string, dir http.File) error // When embedded. Asset func(name string) ([]byte, error) @@ -37,7 +37,7 @@ type DirOptions struct { AssetNames func() []string // Optional validator that loops through each found requested resource. - AssetValidator func(ctx context.Context, name string) bool + AssetValidator func(ctx iris.Context, name string) bool } ``` diff --git a/MVC.md b/MVC.md index 46ef155..69ddbff 100644 --- a/MVC.md +++ b/MVC.md @@ -140,7 +140,7 @@ Where `mvc.Result` is a `hero.Result` type alias, which is this interface one: ```go type Result interface { // Dispatch should sends the response to the context's response writer. - Dispatch(ctx context.Context) + Dispatch(ctx iris.Context) } ``` diff --git a/Routing-context-methods.md b/Routing-context-methods.md index 06355fd..d7f6874 100644 --- a/Routing-context-methods.md +++ b/Routing-context-methods.md @@ -180,7 +180,7 @@ type Context interface { // Next calls all the next handler from the handlers chain, // it should be used inside a middleware. // - // Note: Custom context should override this method in order to be able to pass its own context.Context implementation. + // Note: Custom context should override this method in order to be able to pass its own iris.Context implementation. Next() // NextOr checks if chain has a next handler, if so then it executes it // otherwise it sets a new chain assigned to this Context based on the given handler(s) @@ -514,7 +514,7 @@ type Context interface { // to be executed. Next handlers are being executed on iris because you can alt the // error code and change it to a more specific one, i.e // users := app.Party("/users") - // users.Done(func(ctx context.Context){ if ctx.StatusCode() == 400 { /* custom error code for /users */ }}) + // users.Done(func(ctx iris.Context){ if ctx.StatusCode() == 400 { /* custom error code for /users */ }}) NotFound() // +------------------------------------------------------------+ diff --git a/Routing-error-handlers.md b/Routing-error-handlers.md index df485d8..7b5159b 100644 --- a/Routing-error-handlers.md +++ b/Routing-error-handlers.md @@ -33,7 +33,7 @@ func internalServerError(ctx iris.Context) { ctx.WriteString("Oups something went wrong, try again") } -func index(ctx context.Context) { +func index(ctx iris.Context) { ctx.View("index.html") } ``` diff --git a/Routing-override-context.md b/Routing-override-context.md index 2028c8d..d2feab9 100644 --- a/Routing-override-context.md +++ b/Routing-override-context.md @@ -25,14 +25,14 @@ import ( // 2. // Create your own custom Context, put any fields you'll need. type MyContext struct { - // Embed the `context.Context` - + // Embed the `iris.Context` - // It's totally optional but you will need this if you // don't want to override all the context's methods! - context.Context + iris.Context } -// Optionally: validate MyContext implements context.Context on compile-time. -var _ context.Context = &MyContext{} +// Optionally: validate MyContext implements iris.Context on compile-time. +var _ iris.Context = &MyContext{} // 3. func (ctx *MyContext) Do(handlers context.Handlers) { @@ -59,7 +59,7 @@ func main() { app := iris.New() // 4. - app.ContextPool.Attach(func() context.Context { + app.ContextPool.Attach(func() iris.Context { return &MyContext{ // If you use the embedded Context, // call the `context.NewContext` to create one: @@ -72,7 +72,7 @@ func main() { // Register your route, as you normally do app.Handle("GET", "/", recordWhichContextForExample, - func(ctx context.Context) { + func(ctx iris.Context) { // use the context's overridden HTML method. ctx.HTML("

Hello from my custom context's HTML!

") }) @@ -81,7 +81,7 @@ func main() { // MyContext.Context embedded default context // when MyContext is not directly define the View function by itself. app.Handle("GET", "/hi/{firstname:alphabetical}",recordWhichContextForExample, - func(ctx context.Context) { + func(ctx iris.Context) { firstname := ctx.Values().GetString("firstname") ctx.ViewData("firstname", firstname) @@ -94,7 +94,7 @@ func main() { } // Should always print "($PATH) Handler is executing from 'MyContext'" -func recordWhichContextForExample(ctx context.Context) { +func recordWhichContextForExample(ctx iris.Context) { ctx.Application().Logger().Infof("(%s) Handler is executing from: '%s'", ctx.Path(), reflect.TypeOf(ctx).Elem().Name())