remove the process handler override
This commit is contained in:
@@ -21,10 +21,6 @@ type Process struct {
|
||||
config ModelConfig
|
||||
cmd *exec.Cmd
|
||||
logMonitor *LogMonitor
|
||||
|
||||
// Only useful for go testing the proxy functionality
|
||||
// will leave the start/stop of process to go code
|
||||
overrideProxyFunc *func(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
func NewProcess(ID string, config ModelConfig, logMonitor *LogMonitor) *Process {
|
||||
@@ -170,19 +166,6 @@ func (p *Process) checkHealthEndpoint(cmdCtx context.Context, healthCheckTimeout
|
||||
}
|
||||
|
||||
func (p *Process) ProxyRequest(w http.ResponseWriter, r *http.Request) {
|
||||
if p.overrideProxyFunc != nil {
|
||||
(*p.overrideProxyFunc)(w, r)
|
||||
} else {
|
||||
p.defaultProxyHandler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Process) SetOverride(f func(http.ResponseWriter, *http.Request)) {
|
||||
p.overrideProxyFunc = &f
|
||||
}
|
||||
|
||||
// sends the request to the upstream process
|
||||
func (p *Process) defaultProxyHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if p.cmd == nil {
|
||||
http.Error(w, "process not started", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user