mirror of
https://github.com/kerberos-io/onvif.git
synced 2025-10-14 20:05:42 +08:00
api: fix bugs
This commit is contained in:
@@ -21,7 +21,6 @@ func RunApi () {
|
||||
router.POST("/:service/:method", func(c *gin.Context) {
|
||||
serviceName := c.Param("service")
|
||||
methodName := c.Param("method")
|
||||
//todo: login, pass, deviceXaddr
|
||||
username := c.GetHeader("username")
|
||||
pass := c.GetHeader("password")
|
||||
xaddr := c.GetHeader("xaddr")
|
||||
@@ -227,7 +226,7 @@ func xmlMaker(lst* []interface{}, tags* []map[string]string, lstIndex int) (stri
|
||||
}
|
||||
|
||||
func xmlProcessing (tg string) (string, error) {
|
||||
r, _ := regexp.Compile(`\"(.*?)\"`)
|
||||
r, _ := regexp.Compile(`"(.*?)"`)
|
||||
str := r.FindStringSubmatch(tg)
|
||||
if len(str) == 0 {
|
||||
return "", errors.New("out of range")
|
||||
|
@@ -73,6 +73,8 @@ func GetDeviceStructByName(name string) (interface{}, error) {
|
||||
switch name {
|
||||
case "CreateUsers":
|
||||
return &Device.CreateUsers{}, nil
|
||||
case "GetCapabilities":
|
||||
return &Device.GetCapabilities{}, nil
|
||||
default:
|
||||
return nil, errors.New("there is no such method in the Device service")
|
||||
}
|
||||
|
Reference in New Issue
Block a user