|
|
@ -67,7 +67,7 @@ var SigStartRouteHandler = signals.New((OnStartRouteHandler)(nil)) |
|
|
|
//
|
|
|
|
// Access to the raw net/http.ResponseWriter and net/http.Request can be had
|
|
|
|
// through the Context.Response() and Context.Request() methods.
|
|
|
|
type OnStartRouteHandler func(*Route, Context) signals.Context |
|
|
|
type OnStartRouteHandler func(*Route, Context, signals.Context) |
|
|
|
|
|
|
|
// SigEndRouteHandler emits when the route has finished all code paths and is
|
|
|
|
// preparing to exit. It is not possible to modify the response, response
|
|
|
@ -76,10 +76,11 @@ type OnStartRouteHandler func(*Route, Context) signals.Context |
|
|
|
// extensions that have hooked into the route signaling.
|
|
|
|
var SigEndRouteHandler = signals.New((OnEndRouteHandler)(nil)) |
|
|
|
|
|
|
|
// OnEndRouteHandler accepts a capstan.Route and capstan.Context.
|
|
|
|
// OnEndRouteHandler accepts a capstan.Route, capstan.Context, and the current
|
|
|
|
// signals.Context as returned by OnStartRouteHandler.
|
|
|
|
//
|
|
|
|
// The capstan.Route cannot be modified in this phase.
|
|
|
|
type OnEndRouteHandler func(*Route, Context) |
|
|
|
type OnEndRouteHandler func(*Route, Context, signals.Context) |
|
|
|
|
|
|
|
// SigBeforeResponse emits after the response context and headers have been
|
|
|
|
// setup but before any potential protocol upgrades are made (e.g. WebSockets).
|
|
|
@ -88,7 +89,7 @@ var SigBeforeResponse = signals.New((OnBeforeResponse)(nil)) |
|
|
|
// OnBeforeResponse accepts the Capstan Context and Route. If a signals.Context
|
|
|
|
// value is returned and its Error() value is set with a code >= 400, this will
|
|
|
|
// skip immediately to the route's error handling.
|
|
|
|
type OnBeforeResponse func(Context, *Route) signals.Context |
|
|
|
type OnBeforeResponse func(Context, *Route, signals.Context) |
|
|
|
|
|
|
|
// SigAfterResponse emits after the route has been handled and a response is
|
|
|
|
// in-flight but before any error handling code is processed.
|
|
|
@ -102,7 +103,7 @@ var SigAfterResponse = signals.New((OnAfterResponse)(nil)) |
|
|
|
// OnAfterResponse accepts the Capstan Context and a possible error value. Note
|
|
|
|
// that the error value may be nil, capstan.Context, capstan/errors.Redirect,
|
|
|
|
// capstan/errors.Internal, or of error.
|
|
|
|
type OnAfterResponse func(Context, error) signals.Context |
|
|
|
type OnAfterResponse func(Context, signals.Context, error) |
|
|
|
|
|
|
|
// SigConnectionUpgraded emits when the route has been configured to produce a
|
|
|
|
// connection upgrade header, such as for WebSockets. This signal will not be
|
|
|
@ -112,7 +113,7 @@ var SigConnectionUpgraded = signals.New((OnConnectionUpgraded)(nil)) |
|
|
|
|
|
|
|
// OnConnectionUpgraded accepts the capstan.Context and its state immediately
|
|
|
|
// after a successful upgrade.
|
|
|
|
type OnConnectionUpgraded func(Context) |
|
|
|
type OnConnectionUpgraded func(Context, signals.Context) |
|
|
|
|
|
|
|
// SigRouteError emits immediately after any error condition has been raised but
|
|
|
|
// will not emit if the handled route's endpoint has returned nil (this is in
|
|
|
@ -132,7 +133,7 @@ var SigRouteError = signals.New((OnRouteError)(nil)) |
|
|
|
// as well as Context.HasError(). If a capstan.Context has been returned and
|
|
|
|
// there is an error condition, both Context.HasError() and Context.Error() will
|
|
|
|
// return useful information.
|
|
|
|
type OnRouteError func(*Route, Context, error) signals.Context |
|
|
|
type OnRouteError func(*Route, Context, signals.Context, error) |
|
|
|
|
|
|
|
// SigRouteWriteError emits when an error condition has been reached but prior
|
|
|
|
// to the error being written to the HTTP client. This signal may be used to
|
|
|
|