Replace deprecated io/ioutil with io in whipservice (#4375)

ioutil.ReadAll has been deprecated since Go 1.16 in favor of io.ReadAll.
This was the last remaining io/ioutil usage in the codebase.
This commit is contained in:
Charlie Tonneslan
2026-03-21 10:01:30 -07:00
committed by GitHub
parent 89410df74c
commit 8cdd6f4cc7
+3 -3
View File
@@ -18,7 +18,7 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@@ -156,7 +156,7 @@ func (s *WHIPService) validateCreate(r *http.Request) (*createRequest, int, erro
fromIngress := r.Header.Get("X-Livekit-Ingress") fromIngress := r.Header.Get("X-Livekit-Ingress")
offerSDPBytes, err := ioutil.ReadAll(r.Body) offerSDPBytes, err := io.ReadAll(r.Body)
if err != nil { if err != nil {
return nil, http.StatusBadRequest, fmt.Errorf("body does not have SDP offer: %s", err) return nil, http.StatusBadRequest, fmt.Errorf("body does not have SDP offer: %s", err)
} }
@@ -462,7 +462,7 @@ func (s *WHIPService) handleParticipantPatch(w http.ResponseWriter, r *http.Requ
return return
} }
sdpFragmentBytes, err := ioutil.ReadAll(r.Body) sdpFragmentBytes, err := io.ReadAll(r.Body)
if err != nil { if err != nil {
s.handleError("Patch", w, r, http.StatusBadRequest, fmt.Errorf("body does not have SDP fragment: %s", err)) s.handleError("Patch", w, r, http.StatusBadRequest, fmt.Errorf("body does not have SDP fragment: %s", err))
return return