Skip to content

Commit

Permalink
api: return 500 instead of 404 in case of non-existing items (#2582)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aler9 committed Oct 27, 2023
1 parent 6af27fd commit 07ff79f
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 124 deletions.
112 changes: 36 additions & 76 deletions apidocs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/global/patch:
patch:
Expand All @@ -653,7 +653,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/pathdefaults/get:
get:
Expand All @@ -670,7 +670,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/pathdefaults/patch:
patch:
Expand All @@ -689,7 +689,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/paths/list:
get:
Expand Down Expand Up @@ -719,7 +719,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/paths/get/{name}:
get:
Expand All @@ -743,7 +743,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/paths/add/{name}:
post:
Expand All @@ -769,7 +769,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/config/paths/patch/{name}:
patch:
Expand All @@ -794,10 +794,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: configuration not found.
'500':
description: internal server error.
description: server error.

/v3/config/paths/replace/{name}:
post:
Expand All @@ -822,10 +820,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: configuration not found.
'500':
description: internal server error.
description: server error.

/v3/config/paths/delete/{name}:
delete:
Expand All @@ -844,10 +840,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: configuration not found.
'500':
description: internal server error.
description: server error.

/v3/hlsmuxers/list:
get:
Expand Down Expand Up @@ -877,7 +871,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/hlsmuxers/get/{name}:
get:
Expand All @@ -900,10 +894,8 @@ paths:
$ref: '#/components/schemas/HLSMuxer'
'400':
description: invalid request.
'404':
description: muxer not found.
'500':
description: internal server error.
description: server error.

/v3/paths/list:
get:
Expand Down Expand Up @@ -933,7 +925,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/paths/get/{name}:
get:
Expand All @@ -956,10 +948,8 @@ paths:
$ref: '#/components/schemas/Path'
'400':
description: invalid request.
'404':
description: path not found.
'500':
description: internal server error.
description: server error.

/v3/rtspconns/list:
get:
Expand Down Expand Up @@ -989,7 +979,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/rtspconns/get/{id}:
get:
Expand All @@ -1012,10 +1002,8 @@ paths:
$ref: '#/components/schemas/RTSPConn'
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/rtspsessions/list:
get:
Expand Down Expand Up @@ -1045,7 +1033,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/rtspsessions/get/{id}:
get:
Expand All @@ -1068,10 +1056,8 @@ paths:
$ref: '#/components/schemas/RTSPSession'
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtspsessions/kick/{id}:
post:
Expand All @@ -1090,10 +1076,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtspsconns/list:
get:
Expand Down Expand Up @@ -1123,7 +1107,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/rtspsconns/get/{id}:
get:
Expand All @@ -1146,10 +1130,8 @@ paths:
$ref: '#/components/schemas/RTSPConn'
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/rtspssessions/list:
get:
Expand Down Expand Up @@ -1178,10 +1160,8 @@ paths:
$ref: '#/components/schemas/RTSPSessionList'
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtspssessions/get/{id}:
get:
Expand All @@ -1204,10 +1184,8 @@ paths:
$ref: '#/components/schemas/RTSPSession'
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtspssessions/kick/{id}:
post:
Expand All @@ -1226,10 +1204,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtmpconns/list:
get:
Expand Down Expand Up @@ -1259,7 +1235,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/rtmpconns/get/{id}:
get:
Expand All @@ -1282,10 +1258,8 @@ paths:
$ref: '#/components/schemas/RTMPConn'
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/rtmpconns/kick/{id}:
post:
Expand All @@ -1304,10 +1278,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/rtmpsconns/list:
get:
Expand Down Expand Up @@ -1337,7 +1309,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/rtmpsconns/get/{id}:
get:
Expand All @@ -1360,10 +1332,8 @@ paths:
$ref: '#/components/schemas/RTMPConn'
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/rtmpsconns/kick/{id}:
post:
Expand All @@ -1382,10 +1352,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/srtconns/list:
get:
Expand Down Expand Up @@ -1415,7 +1383,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/srtconns/get/{id}:
get:
Expand All @@ -1438,10 +1406,8 @@ paths:
$ref: '#/components/schemas/SRTConn'
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/srtconns/kick/{id}:
post:
Expand All @@ -1460,10 +1426,8 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: connection not found.
'500':
description: internal server error.
description: server error.

/v3/webrtcsessions/list:
get:
Expand Down Expand Up @@ -1493,7 +1457,7 @@ paths:
'400':
description: invalid request.
'500':
description: internal server error.
description: server error.

/v3/webrtcsessions/get/{id}:
get:
Expand All @@ -1516,10 +1480,8 @@ paths:
$ref: '#/components/schemas/WebRTCSession'
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.

/v3/webrtcsessions/kick/{id}:
post:
Expand All @@ -1538,7 +1500,5 @@ paths:
description: the request was successful.
'400':
description: invalid request.
'404':
description: session not found.
'500':
description: internal server error.
description: server error.
Loading

0 comments on commit 07ff79f

Please sign in to comment.