fix: pull api return json format

This commit is contained in:
langhuihui
2023-11-17 17:40:23 +08:00
parent 5257598847
commit 1898dfa507

View File

@@ -52,9 +52,9 @@ func str2number(s string) int {
func (c *HDLConfig) API_Pull(rw http.ResponseWriter, r *http.Request) {
err := HDLPlugin.Pull(r.URL.Query().Get("streamPath"), r.URL.Query().Get("target"), NewHDLPuller(), str2number(r.URL.Query().Get("save")))
if err != nil {
http.Error(rw, err.Error(), http.StatusBadRequest)
util.ReturnError(util.APIErrorPublish, err.Error(), rw, r)
} else {
rw.Write([]byte("ok"))
util.ReturnOK(rw, r)
}
}