engine: catchall handler is shadowed by specific handlers
This allows using `Engine.Register` and `Engine.RegisterCatchall` on the same engine without the catchall hiding all other handlers. Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
103d028132
commit
de75af9fe2
|
@ -118,13 +118,12 @@ func (eng *Engine) Job(name string, args ...string) *Job {
|
||||||
if eng.Logging {
|
if eng.Logging {
|
||||||
job.Stderr.Add(utils.NopWriteCloser(eng.Stderr))
|
job.Stderr.Add(utils.NopWriteCloser(eng.Stderr))
|
||||||
}
|
}
|
||||||
if eng.catchall != nil {
|
|
||||||
|
// Catchall is shadowed by specific Register.
|
||||||
|
if handler, exists := eng.handlers[name]; exists {
|
||||||
|
job.handler = handler
|
||||||
|
} else if eng.catchall != nil {
|
||||||
job.handler = eng.catchall
|
job.handler = eng.catchall
|
||||||
} else {
|
|
||||||
handler, exists := eng.handlers[name]
|
|
||||||
if exists {
|
|
||||||
job.handler = handler
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return job
|
return job
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue