mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-10-06 08:06:58 +08:00
api: return 500 instead of 404 in case of non-existing items (#2582)
This is needed to differentiate between calls to non-existent andpoints and calls to valid endpoints, but with an ID pointing to a non-existing item, and to return JSON in the latter case.
This commit is contained in:
@@ -220,7 +220,7 @@ outer:
|
||||
case req := <-s.chAPIConnsGet:
|
||||
c := s.findConnByUUID(req.uuid)
|
||||
if c == nil {
|
||||
req.res <- rtmpServerAPIConnsGetRes{err: errAPINotFound}
|
||||
req.res <- rtmpServerAPIConnsGetRes{err: fmt.Errorf("connection not found")}
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ outer:
|
||||
case req := <-s.chAPIConnsKick:
|
||||
c := s.findConnByUUID(req.uuid)
|
||||
if c == nil {
|
||||
req.res <- rtmpServerAPIConnsKickRes{err: errAPINotFound}
|
||||
req.res <- rtmpServerAPIConnsKickRes{err: fmt.Errorf("connection not found")}
|
||||
continue
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user