mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
add 'Context.Register/RemoveDependency' for registering dependencies for next handler in the chain from a common iris handler in serve-time
And also, add a Configuration.FireEmptyFormError if end-dev wants to receive an iris.ErrEmptyForm error on missing form data on 'Context.ReadForm/ReadBody' Former-commit-id: a2713bec77375b2908f1f066a46be4f19e6b7a61
This commit is contained in:
@@ -323,6 +323,14 @@ func payloadBinding(index int, typ reflect.Type) *binding {
|
||||
Handle: func(ctx context.Context, input *Input) (newValue reflect.Value, err error) {
|
||||
wasPtr := input.Type.Kind() == reflect.Ptr
|
||||
|
||||
if serveDepsV := ctx.Values().Get(context.DependenciesContextKey); serveDepsV != nil {
|
||||
if serveDeps, ok := serveDepsV.(context.DependenciesMap); ok {
|
||||
if newValue, ok = serveDeps[typ]; ok {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newValue = reflect.New(indirectType(input.Type))
|
||||
ptr := newValue.Interface()
|
||||
err = ctx.ReadBody(ptr)
|
||||
|
||||
Reference in New Issue
Block a user