(w http.ResponseWriter, r *http.Request)
| 346 | } |
| 347 | |
| 348 | func (this *ControlServer) HandleScript(w http.ResponseWriter, r *http.Request) { |
| 349 | if this.Config.CustomScripts == nil { |
| 350 | http.NotFound(w, r) |
| 351 | return |
| 352 | } |
| 353 | |
| 354 | name, err := scriptName(r) |
| 355 | if err != nil { |
| 356 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 357 | return |
| 358 | } |
| 359 | |
| 360 | cmd, found := this.Config.CustomScripts[name] |
| 361 | if !found { |
| 362 | http.NotFound(w, r) |
| 363 | return |
| 364 | } |
| 365 | |
| 366 | this.startScriptInBackground(name, cmd) |
| 367 | returnSuccess(w, r) |
| 368 | } |
| 369 | |
| 370 | func (this *ControlServer) HandleConfigGet(w http.ResponseWriter, r *http.Request) { |
| 371 | w.Header().Set("Content-Type", "application/json") |
nothing calls this directly
no test coverage detected