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
@@ -111,6 +111,14 @@ func handleTCP(rawURL string) (core.Producer, error) {
}
func apiStream(w http.ResponseWriter, r *http.Request) {
if api.IsReadOnly() {
switch r.Method {
case "PUT", "PATCH", "POST", "DELETE":
api.ReadOnlyError(w)
return
}
}
dst := r.URL.Query().Get("dst")
stream := streams.Get(dst)
if stream == nil {