this fixes a regression introduced in v0.23.0.
This commit is contained in:
parent
f162ce1f07
commit
e2a6c380b0
|
@ -346,6 +346,10 @@ func (a *api) onConfigPathsAdd(ctx *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
newConfPath := &conf.PathConf{}
|
newConfPath := &conf.PathConf{}
|
||||||
|
|
||||||
|
// load default values
|
||||||
|
newConfPath.UnmarshalJSON([]byte("{}"))
|
||||||
|
|
||||||
fillStruct(newConfPath, in)
|
fillStruct(newConfPath, in)
|
||||||
|
|
||||||
newConf.Paths[name] = newConfPath
|
newConf.Paths[name] = newConfPath
|
||||||
|
|
|
@ -148,10 +148,16 @@ func TestAPIConfigPathsAdd(t *testing.T) {
|
||||||
"sourceOnDemand": true,
|
"sourceOnDemand": true,
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
var out map[string]interface{}
|
var out struct {
|
||||||
|
Paths map[string]struct {
|
||||||
|
Source string `json:"source"`
|
||||||
|
SourceOnDemandStartTimeout string `json:"sourceOnDemandStartTimeout"`
|
||||||
|
} `json:"paths"`
|
||||||
|
}
|
||||||
|
|
||||||
httpRequest(t, hc, http.MethodGet, "http://localhost:9997/v2/config/get", nil, &out)
|
httpRequest(t, hc, http.MethodGet, "http://localhost:9997/v2/config/get", nil, &out)
|
||||||
require.Equal(t, "rtsp://127.0.0.1:9999/mypath",
|
require.Equal(t, "rtsp://127.0.0.1:9999/mypath", out.Paths["my/path"].Source)
|
||||||
out["paths"].(map[string]interface{})["my/path"].(map[string]interface{})["source"])
|
require.Equal(t, "10s", out.Paths["my/path"].SourceOnDemandStartTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAPIConfigPathsEdit(t *testing.T) {
|
func TestAPIConfigPathsEdit(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue