feat: implement read-only mode enforcement in API handlers and add corresponding tests

This commit is contained in:
Sergey Krashevich
2026-02-01 05:46:20 +03:00
parent 51b79e614f
commit bc7f9c0f79
4 changed files with 76 additions and 0 deletions
+8
View File
@@ -21,6 +21,14 @@ const MimeSDP = "application/sdp"
var sessions = map[string]*webrtc.Conn{}
func syncHandler(w http.ResponseWriter, r *http.Request) {
if api.IsReadOnly() {
switch r.Method {
case "POST", "PATCH", "DELETE":
api.ReadOnlyError(w)
return
}
}
switch r.Method {
case "POST":
query := r.URL.Query()