1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-07 20:17:05 +00:00
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-08-15 12:17:48 +03:00
parent d0d7679a98
commit 8340285e7d
11 changed files with 105 additions and 11 deletions

View File

@@ -41,11 +41,11 @@ type Party interface {
// OnErrorCode registers a handlers chain for this `Party` for a specific HTTP status code.
// Read more at: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
// Look `OnAnyErrorCode` too.
// Look `UseError` and `OnAnyErrorCode` too.
OnErrorCode(statusCode int, handlers ...context.Handler) []*Route
// OnAnyErrorCode registers a handlers chain for all error codes
// (4xxx and 5xxx, change the `ClientErrorCodes` and `ServerErrorCodes` variables to modify those)
// Look `OnErrorCode` too.
// Look `UseError` and `OnErrorCode` too.
OnAnyErrorCode(handlers ...context.Handler) []*Route
// Party returns a new child Party which inherites its
@@ -96,6 +96,10 @@ type Party interface {
// The context SHOULD call its `Next` method in order to proceed to
// the next handler in the chain or the main request handler one.
UseRouter(handlers ...context.Handler)
// UseError upserts one or more handlers that will be fired,
// as middleware, before any error handler registered through `On(Any)ErrorCode`.
// See `OnErrorCode` too.
UseError(handlers ...context.Handler)
// Use appends Handler(s) to the current Party's routes and child routes.
// If the current Party is the root, then it registers the middleware to all child Parties' routes too.
Use(middleware ...context.Handler)